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

Spaces don't trigger autocompletion #203

Closed
andfoy opened this issue Nov 16, 2017 · 7 comments
Closed

Spaces don't trigger autocompletion #203

andfoy opened this issue Nov 16, 2017 · 7 comments

Comments

@andfoy
Copy link
Contributor

andfoy commented Nov 16, 2017

Under recommended settings, the LSP client does not emit a textDocument/completion request when an space is entered. This behaviour may limit some autocompletions on some languages, specially if they are required after a keyword. For instance, on Python an user may want to get package suggestions after writing import.

Right now, the only option relies on using Sublime default/defined autocompletion key (e.g., Alt0 + /) shortcut after writing another character; if this shortcut is invoked just before after writing the keyboard import it will remove the whitespace and move the cursor back to the end of the keyboard, giving possible autocompletion options that involve the word "import". For illustrative purposes, here's a GIF of the current behaviour:

peek 16-11-2017 15-07

@tomv564
Copy link
Contributor

tomv564 commented Nov 16, 2017

Great bug report!
This looks to be the undo command being incorrectly fired by LSP, which @randy3k just tightened down in the open PR #197

@tomv564
Copy link
Contributor

tomv564 commented Nov 16, 2017

The above fix helped, but I still see the following in master with OS-X dev build 3154:
from a -> ['abc', 'activate_this', 'aifc', 'antigravity', 'argparse', 'array', 'ast', 'asynchat', 'asyncio', 'asyncore', 'atexit', 'audioop'] (expected)
import a -> no completions

Can you confirm if you see this difference, and what build/platform are you using?

@randy3k
Copy link
Contributor

randy3k commented Nov 17, 2017

@tomv564 I confirm your findings -- import a shows nothing for me. But it is like that even before #197 was merged.

@randy3k
Copy link
Contributor

randy3k commented Nov 17, 2017

import a shows nothing because of Sublime Text python completion rule which explicitly disables autocomplete after import. One would need to trigger the completion menu manually.

@tomv564
Copy link
Contributor

tomv564 commented Nov 17, 2017

Thanks for solving that mystery! I will ask about that LSP bypassing that rule on the forums

@tomv564
Copy link
Contributor

tomv564 commented Nov 18, 2017

The Anaconda package recommends overriding the Python Completion Rules.tmPreferences with your own ( https://github.com/DamnWidget/anaconda#auto-complete-for-import-behaves-badly)

This together with the completion triggers and the snippet completions that cannot be disabled is starting to be a bit of a fight against Sublime's defaults (which are reasonable for their built-in completion functionality).

@tomv564
Copy link
Contributor

tomv564 commented Aug 27, 2019

Closing this after documenting/linking to the workaround. As it appears pull requests to adjust built-in completion rules are being merged, a willing volunteer may have some luck proposing a fix at https://github.com/sublimehq/Packages

@tomv564 tomv564 closed this as completed Aug 27, 2019
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

3 participants