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

Error for autocompletion of perl command #3856

Closed
WhyCannotIPostAnonymously opened this issue Feb 18, 2017 · 4 comments
Closed

Error for autocompletion of perl command #3856

WhyCannotIPostAnonymously opened this issue Feb 18, 2017 · 4 comments
Labels
bug Something that's not working as intended completions
Milestone

Comments

@WhyCannotIPostAnonymously

Hi,

When I type perl - in fish, it outputs the following and the autocompletion does not work.

$, is not a valid variable in fish.
/usr/share/fish/completions/perl.fish (line 5):                         | sed -e 's,/,::,g; s,\.pm$,,' | sort -u)"
                                                                                                  ^
from sourcing file /usr/share/fish/completions/perl.fish
    called on standard input

in command substitution
    called on standard input

source: Error while reading file “/usr/share/fish/completions/perl.fish”

If I add a slash before the $ in the file, the autocompletion works.

@krader1961 krader1961 added bug Something that's not working as intended completions labels Feb 18, 2017
@krader1961 krader1961 added this to the fish-future milestone Feb 18, 2017
@krader1961
Copy link
Contributor

Quotes don't nest in the manner the person who wrote that expected. Also, it makes more sense from a performance perspective to calculate the list of modules once when that completion script is loaded rather than every time the module completion is invoked.

Want to take a stab at fixing this, @WhyCannotIPostAnonymously?

@WhyCannotIPostAnonymously
Copy link
Author

The autocompletion depends upon the current directory since perl -lE'print for @INC' returns the path . (on my computer, along with absolute ones). So one would need something more complicated than just caching the result. (And one would also need to assume that the result of perl -lE'print for @INC' is constant, or it would become even more complex.) An alternative is to only autocomplete for the absolute paths in perl -lE'print for @INC'

Want to take a stab at fixing this, @WhyCannotIPostAnonymously?

Well… I just program very casually, and I don't know how things are organized in fish and where to put global variables for that. If I can do something why not but I'm not confident and it would take me too much time (I never used git, etc.).

@krader1961
Copy link
Contributor

krader1961 commented Feb 19, 2017

Not a problem, @WhyCannotIPostAnonymously. It's just that this has been broken for at least 2.5 years according to git blame share/completions/perl.fish. So unless someone like yourself who is bothered by the bug, knowledgable about Perl, and willing to create a fix does so it may be a long time before it is fixed.

I used to be a Perl guru but lost that status a decade ago when I switched to Python. I'm happy to fix the proximate problem but am not interested in spending a lot of time relearning about Perl's import mechanism and why . is in its @INC variable by default. If you don't care that the current implementation is hideously inefficient I'll just fix the core bug. Otherwise you'll need to provide more advice regarding how you think this completion should behave. For example, would it be sufficient to cache and present only modules based on absolute paths? That assumes a perl user doesn't need completion help for modules in their current project directory. It's not clear whether that is a reasonable assumption.

@krader1961
Copy link
Contributor

@WhyCannotIPostAnonymously, I fixed the problem you reported. Feel free to open a new issue if you want to pursue making the perl completions more efficient.

@faho faho modified the milestones: 2.6.0, fish-future Mar 29, 2017
develop7 pushed a commit to develop7/fish-shell that referenced this issue Apr 17, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 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 completions
Projects
None yet
Development

No branches or pull requests

3 participants