pappasam / jedi-language-server

A Python language server exclusively for Jedi. If Jedi supports it well, this language server should too.
MIT License
596 stars 45 forks source link

triple-quotes cause completion of files in the current working direcrory #270

Open greggthomason opened 1 year ago

greggthomason commented 1 year ago

Version 0.40.0, Python 3.11.3 via Homebrew on Mac OS X 13.3.1(a). Using BBEdit.

Screenshot 2023-05-15 at 12 22 06 PM

When doing a triple-quote, I receive completions for files in the same directory as the file I'm editing. I have confirmed w/ the author of BBEdit that it's not doing any docstring completion.

pappasam commented 1 year ago

Have you confirmed that these completions are coming from jedi-language-server? I don't think jedi returns these completions

greggthomason commented 1 year ago

The BBEdit lead dev confirmed to me that it does not generate any completions in docstrings, and does not do completions from the disk in general (only from something like ctags, which I am not using).

greggthomason commented 1 year ago

To clarify slightly: If I disable the jedi server integration and cold-start and open a new buffer, typing """ and pausing does not do anything. If I then re-enable the server, restart, and on a new buffer to """ the immediate completion is the contents of the directory of the file I opened. No completion (of the type I am seeing) is generated until the file is saved, though. Therefore it is reasonable to assume it is the Jedi server, since the editor does not generate the completion unless server integration is active.

davidhalter commented 1 year ago

I'm pretty sure this is coming from Jedi. I understand that it's questionable, but the question is where do you want file completions and where not? I feel like this just depends a lot on the users. I understand that in triple quotes especially in a docstring position these are not very useful.

greggthomason commented 1 year ago

yeah I feel like automatically showing ls $PWD is a weird choice after a triple-quote. I would expect plain ol' symbol completion, and the editor should chose eg to complete strings (or do nothing).

pappasam commented 1 year ago

I see... based on david's input, here are the options I can see:

  1. If we can identify the context being a docstring somehow, we can disable path completions specifically for that context.
  2. If not, we can add an option to disable all path completions.
  3. Finally, regardless of 1 and 2, if this is just mildly annoying, we can simply ignore and hope for an upstream resolution.
greggthomason commented 1 year ago

I would be more than happy with #2.

nic-hartley commented 1 year ago

A couple thoughts: