poetry: Fish completions raise errors but still works
- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- macOS 10.15.7:
- 1.2.0b2:
- fish 3.5:
Issue
I installed the completions as explained in the doc, and completions are working. But there is an error when triggering autocomplete with <kbd>TAB</kbd> key :
~/.config/fish/completions/poetry.fish (line 57):
complete -c poetry -f -n '__fish_poetry_e3d63c4129b80bf7_complete_no_subcommand' -a source show -d 'Show information about sources configured for the project.'
^
from sourcing file ~/.config/fish/completions/poetry.fish
I put the last error only, but the console print this error for almost every line of this file.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 32
- Comments: 46 (11 by maintainers)
Commits related to this issue
- feat: Add option to 'command with space in name' in fixtures * This triggers a bug in 'fish completion' script as described in https://github.com/python-poetry/poetry/issues/5929#issuecomment-1345580... — committed to riton/cleo by riton 2 years ago
- feat: Add option to 'command with space in name' in fixtures * This triggers a bug in 'fish completion' script as described in https://github.com/python-poetry/poetry/issues/5929#issuecomment-1345580... — committed to python-poetry/cleo by riton 2 years ago
- [overlays/poetry] fix completions Temporary fix for python-poetry/poetry#5929. — committed to bfogarty/nix by bfogarty 10 months ago
- poetry: fix completion errors https://github.com/python-poetry/poetry/issues/5929 — committed to boiledfroginthewell/dotfiles by boiledfroginthewell 9 months ago
@neersighted @Secrus I think this issue should be re-open and fix again.
@garbelini Nice friend! Thank you for you solution. It also works for me.
I’m currently using NeoVim as my editor. I used the following command to quickly replace all these extra-quoted commands. It may also valid in Vim.
For my fellow
sd
users the following work and is easier:Contrary to what some earlier regex were looking for, the only problem is double quoting in the same argument (
'[^']+''
)I still get an error using autocomplete in fish.
Poetry (version 1.3.0) fish, version 3.5.1
log
I still see this issue with poetry 1.3.1 and fish 3.6.0 on macosx using homebrew. I’ll see if I can submit a follow-up PR (if there isn’t already one) in the next day or so.
I suggest to re-open the issue, as this issue still persists:
For anyone just looking for the file, here you go: Valid on poetry 1.5.1
~/.config/fish/completions/poetry.fish
@rahul286 thanks
Its worked for me on linux as well…
It takes time, to do things right. At the moment, I am the only person actively working on Cleo maintenance. Everybody on the Poetry team is working on this project as a volunteer, giving it as much of our free time as we can. I understand the frustration when things don’t work as intended, but please have patience.
+1, same issue (and same log) with Poetry 1.3.1 and Fish 3.5.1
The issue is now reopened. Please refrain from “me too” type of comments.
On macOS, the following appears to be working for me.
Please note that I use GNU sed (can be installed using
brew install gnu-sed
. if you do this, read post-install caveats)Yep. Poetry 1.3.2 and Fish 3.6.0 here and seeing the same issue.
The last fix introduced a new issue but now it’s too much quoting.
As a workaround search the the output for instances like
'__fish_seen_subcommand_from 'self add''
and remove the extra quotes'__fish_seen_subcommand_from self add
Seems to work for me
Hi! The issue is still there.
Completion bugs are now fixed with the incoming release.
I see this issue on poetry 1.3.2 on Archlinux
I’ll try to request that cleo get a new release, I’m not sure what the process is for it so I just asked in the discord for now. Will update this comment as appropriate.
I don’t think this issue needs any more updates.
After the next cleo release it will be fixed and otherwise there are a variety of suggestions in the comments for short-term workarounds.
You can check in the poetry discord to see if there’s anything you can do to help with release
I believe poetry 1.4.0 still uses cleo 2.0.1, see my above comment.
the 1.4 branch still has cleo 2.0.1 in its poetry.lock file
I edited
~/.config/fish/completions/poetry.fish
and sorted out mismatched single and double quotes. Now this issue is gone.This is known and I am working on fixing completions in
cleo
right now.btw when I asked last week, the response was that cleo maintainers have some bugs they want to fix before they release. I do not know what the bugs are, so I guess there’s not much to do.
It is still a problem with Poetry 1.4.0 and fish 3.6.0. The problem seems to be that the quoting for the complex commands like “self update” is mangled. I could fix the problem by removing all these quotes around “self update”, “self add”, …
At Fish 3.6.0 at complete there is no option
-A
from 2.5b1
I’m on NixOS, so the default location of the
poetry.fish
completion script isn’t writable. Setting a.config
file makes it use that, though. The workaround for me was copying the file there and applying the quoting to the-a
args:If everything goes according to our plan, update for Cleo should be a part of next minor release of Poetry (1.3 at the moment of writing this). The info will be in the release notes for sure and it will state the need for re-generation of completion files
The Cleo release has not made it into Poetry yet – @Secrus is working on getting a release out this week. Due to neglect/bit rot, Cleo is in a pretty rough state release-wise and is difficult to release. The hope is to reset the board here (and there has been a lot of work to that end) so Cleo can release early and often with Poetry’s needs.
Summary
The problem still exists, but it only occurs when Poetry autocompletion is activated for the first time.
Environments
Steps to reproduce
How should I fix this problem? Shall I upgrade
poetry
to a preview version? Or just simply edit and fix~/.config/fish/completions/poetry.fish
as follows on our own?Click to expand
@mrmeszaros I agree that would be a separate issue, since this one was just focused on the errors/warnings produced by quoting errors. I’m not sure if a related issue already exists, though.
OHHHHH. I see. the problem is just that the fix wasn’t in the release.
This commit (Dec 12, 2022) fixes the issue (because of a typo in the original PR, I assume): https://github.com/python-poetry/cleo/commit/6cc808dd97c811146d72d1c674cfbbdcaf103ce7
but the most recent release of cleo (2.0.1) seems to be Nov 22, 2022? https://github.com/python-poetry/cleo/releases
let me know if the list of releases aren’t actually what’s included in the released version of poetry, but based on
poetry.lock
in the master branch, I’m guessing it is: https://github.com/python-poetry/poetry/blob/master/poetry.lock#L271-L281Poetry (version 1.3.1) fish, version 3.5.1
(just pasting last few lines)
Thanks @garbelini for the workaround, and @Dragon1573 for making it easy to fix!