-
Notifications
You must be signed in to change notification settings - Fork 40
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
Returning a CompletionList() on on_query_completions always do INHIBIT_WORD_COMPLETIONS #4999
Comments
Adding class OnQueryContextBugEventListener(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
clist = sublime.CompletionList()
sublime.set_timeout(lambda: clist.set_completions([], 0))
return clist |
a) I believe your way to "fix" the problem would make it impossible to call b) the behavior seems to me to be like that on purpose since you don't want your word completions to appear until all completions are collected. Otherwise, there might be a situation where the word completions show up just to disappear in 1 second after That said, maybe it should be possible to decide the value of the |
I do not see the point for I agree that accepting flags on A reasonable solution would be for the flag's value to be accepted only on
This would be an unacceptable behavior for me because I would like to get both word completion and the language server completions. With the current LSP implementation, I was never getting word any completions from Sublime Text (no completions in comments, either anywhere else). And the flag I really hate the usage of
Sublime Text built-in word completion is incredible for me at least because by itself it decides most of the time the right completion just based on the word usage/frequency. The language server for me is just a complement to get completions from other files which are not currently open. |
Now that you explain it like that, it sounds like a different issue. Now, the problem with your initial example plugin is that you never resolve the completions so that can affect the results. Can you make a test case that properly resolves the completion (maybe after few seconds)? Does the problem still reproduce then? I would assume that the word completions are shown once the completion list returned from With LSP there should never be the case that the completion list is never resolved. It might take a second or two with slow servers but should always get resolved eventually. |
If I either resolve the completion (one time at least) as done in my "fix" example, or a few seconds later, the word completion shows up, but the difference is that if I add x seconds delay, it takes x seconds for any completion to show up. I rather see the word completion sublime text can build in milliseconds than wait for slower language servers. My LSP was never getting completions for the language server and this is causing word completions to not show up, then, I end up with no completions at all, when I am in places as comments, for example. |
What your are asking for would be a bad experience because user would get word completions right away and then when more relevant completions would come from LSP, the selections would either have to jump to more relevant completions or stay at less relevant. Neither would be good. Not sure what you mean by
By "my LSP" do you mean LSP package or your own LSP server? Because it sounds like a bug in either. |
I am not getting any Sublime Text word completions with https://github.com/sublimelsp/LSP-pylsp language server. If the user enabled the setting What is the point of using asynchronous word completion, if you do not incrementally add completions when they are available? If words from Sublime text are available, I would like to see them right now instead of waiting a few seconds for all of them. Whether you like word completion or not, it does not change the fact that
|
Then maybe deal with that issue? Is it because pylsp never responds to the completion request? That would be a bug in it that should be then fixed. Or is it just very slow, which pylsp is kinda known for? You can switch to LSP-pyright or disable the completions handling in LSP-pylsp completely.
I think many would care since then people would get the less relevant (most of the time useless) word completion selected by default rather than something relevant for the given context (like when completing property name). What you are asking for maybe would make sense to you in which case maybe a new setting could be added in core but changing the behavior of the current settings or flags is not the way to go. So I have a bit of an issue with how this issue is phrased, making it look like a bug. If you would create a feature request for it, that would make more sense IMO.
ST is not an IDE but the point of LSP is exactly to make the coding work like in an IDE. So maybe don't use LSP then? |
An IDE is is an integrated development environment, that means you download a thing and you'll get a bunch of toolchains to get started easily, no need to use a terminal. Press a "play" button and your GUI program shows up ready to debug. LSP doesn't turn Sublime Text into an IDE. |
When I set Schermopname.2021-11-06.om.20.31.59.movI don't get word completions in comments. But that's because the global
This value is set in the default Preferences.sublime-settings. |
Description of the bug
on_query_completions
returning an emptyCompletionList()
always doINHIBIT_WORD_COMPLETIONS
.I use LSP, and it uses this
CompletionList()
onon_query_completions
. This causing the LSP settingprefs.inhibit_word_completions
not work because Sublime Text by itself alwasy doINHIBIT_WORD_COMPLETIONS
even ifCompletionList()
is not requesting it.Steps to reproduce
Create this plugin:
Try to complete something. You will never complete anything ever unless you give completions to
CompletionList()
.Expected behavior
Only do
INHIBIT_WORD_COMPLETIONS
onon_query_completions
when returningCompletionList()
withINHIBIT_WORD_COMPLETIONS
flag.Actual behavior
Doing
INHIBIT_WORD_COMPLETIONS
onon_query_completions
when not returningCompletionList()
withINHIBIT_WORD_COMPLETIONS
flag.Sublime Text build number
4121
Related
The text was updated successfully, but these errors were encountered: