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

Autocorrect bug when completing files names in Code OSS-based IDEs #325

Closed
jthomasmock opened this issue Nov 6, 2024 · 6 comments
Closed

Comments

@jthomasmock
Copy link

When using Jedi as the Language Server in Code OSS-based IDEs or in VS Code, auto-complete of file names at the . is incorrect.

The text is auto-completed at the . instead of replacing the prior text.

Thank you for your time in reviewing this issue.

As an example, see the video below in VS Code with Jedi as the Language Server:

Screen.Cast.2024-11-04.at.4.10.39.PM.mp4

moved over from: davidhalter/jedi#2032

@davidhalter
Copy link

@pappasam Do you know of similar behavior? I haven't seen this or similar issues in the Jedi issue tracker (and there must be an insane amount of people using it).

@dimbleby
Copy link
Contributor

dimbleby commented Nov 7, 2024

I have never seen this in neovim, possibly this is an editor bug all along. Someone would have to get trace of the lsp messages to decide.

Aside: I see quite a few bugs being punted around vscode and this repository and similar; often - as here - without anyone providing any evidence for where it actually belongs. Perhaps editors could be encouraged to make it easier to get useful diagnostics.

While I'm here: I actually wish jedi didn't provide filename completions at all, it seems quite out of scope for a python-analysis tool - and per #270 it's a bit too keen.

@pappasam
Copy link
Owner

pappasam commented Nov 7, 2024

@dimbleby yeah, it seems like a simple solution here might be for us to simply filter out path completions coming from Jedi? See: https://jedi.readthedocs.io/en/latest/docs/api-classes.html#jedi.api.classes.BaseName.type

@jthomasmock
Copy link
Author

jthomasmock commented Nov 7, 2024

Thanks for the discussion so far! I'm not seeing anything useful in the VS Code output for Python Language Server.

For what it's worth, I don't believe Code OSS or VS Code w/ Pylance have built-in filename completions, but some extensions can add it so that could be a suggestion if y'all do allow disabling file completions?

@davidhalter
Copy link

The issue here might be connected to

def clean_completion_name(name: str, char_before_cursor: str) -> str:
, because some characters are stripped, which might lead to a weird interaction with VSCode.

I was able to reproduce it in VSCode. It happens only after a dot in a string (i.e completing "setup is fine, but "setup. is not. Jedi looks fine:

>>> jedi.Script('"setup.').complete()
[<Completion: setup.cfg">, <Completion: setup.py">]
>>> jedi.Script('"setup.').complete()[0]
<Completion: setup.cfg">
>>> jedi.Script('"setup.').complete()[0].name
'setup.cfg"'
>>> jedi.Script('"setup.').complete()[0].complete

@pappasam
Copy link
Owner

pappasam commented Nov 8, 2024

Should be resolved in the latest release: https://github.com/pappasam/jedi-language-server/releases/tag/v0.42.0

@pappasam pappasam closed this as completed Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants