Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functions or type command will show the wrong line number of an one-line function's definition #5685

Closed
c02y opened this issue Feb 22, 2019 · 3 comments
Labels
bug Something that's not working as intended
Milestone

Comments

@c02y
Copy link

c02y commented Feb 22, 2019

fish, version 3.0.1

I tried to replace all my aliases with abbrs, but since I used some aliases inside other functions defined in my config.fish, and abbrs cannot be used in this kind of situations, I have to use functions here.

And alias is short, such as add a default option for a command, for example
old alias:

alias find 'find -L'

new function:

function find; command find -L $argv; end

I'll use find command in other functions, and I hope these functions could use find with -L option, I don't have to add -L every time when I use it.

type find command or functions find will show its definition along with file and line number where it is defined.
So, the problem is, when I redefined a short alias to one line function like I the find function I posted, the line number of the result will be wrong. The real line number in config.fish in $NUM, but the line number in type or functions is $NUM-1, since I defined another function which will extract this number out, and use it, so this is a problem to me.

If the function is defined into multiple line like this:

function find
    command find -L $argv
end

The line number in type or functions is correct.

Is this a bug?

@c02y c02y changed the title functions or type command will show the wrong line number of a function's definition functions or type command will show the wrong line number of an one-line function's definition Feb 22, 2019
@ridiculousfish
Copy link
Member

Looks like, fun find!

@ridiculousfish ridiculousfish added this to the fish-future milestone Feb 24, 2019
@zanchey zanchey added the bug Something that's not working as intended label Feb 25, 2019
@krobelus
Copy link
Member

krobelus commented Oct 4, 2019

seems to work fine here, can you provide a small example?

@faho
Copy link
Member

faho commented Jan 3, 2020

I can't reproduce this, so I'm assuming it's fixed. Also compare #6350.

@faho faho closed this as completed Jan 3, 2020
@faho faho modified the milestones: fish-future, fish 3.1.0 Jan 3, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something that's not working as intended
Projects
None yet
Development

No branches or pull requests

5 participants