Comments (13)
I agree! To rephrase it a bit: Every time ST shows autocompletions, a request should be made to the server. ST does this by default only for "alpha" characters. This is why the autocomplete_triggers
should be used to invoke additional autocompletion queries.
from lsp.
In #4 was discussed how to easily setup these additional triggers. With the knowledge about language-servers providing these information, I could imagine to automatically add this setting to each supported view. This way no trigger needs to be configured by user.
from lsp.
This investigation supports your conclusion:
microsoft/language-server-protocol#268
and I am for turning on completions for alphanumeric characters.
But I would like to verify that the performance is acceptable, some recent implementations against the javascript/typescript implementations ran into problems: sourcegraph/javascript-typescript-langserver#331
from lsp.
@philippotto, it might be good to have the Flow language server additionally send ['.']
for triggerCharacters. Do you want to create an issue?
from lsp.
@tomv564 Sure, I created it here.
Regarding potential performance problems, this answer from your referenced issue is interesting:
Drastically reducing how often we called completion has solved problems on Atom. Now we just trigger it on . and when manually requested.
As long as autocompletions are not blazingly fast anyway, I would leave it at that logic (on . and manually requesting). Hitting CTRL + Space for requesting autocompletions is probably idiomatic? We could still have a setting for triggering it after each keystroke (throttled), which is off by default maybe?
from lsp.
The current implementation always cancels auto-completions not triggered by the triggerCharacter. No matter whether it is triggered automatically or manually by Ctrl+Space. A package doesn't know whether completion was triggered manually or automatically.
I saw implementations, which returned no completions with word and explicit completions disabled in on_query_completion() but only fired the request to the language server. If the respond is received, they manually called show_completion to open it. This may cause some delay but doesn't cause ST to block while waiting for an answer.
from lsp.
A package doesn't know whether completion was triggered manually or automatically.
Couldn't we add a keybinding for ctrl + space which calls show_completion?
from lsp.
@philippotto ctrl+space is already hooked up, but LSP disables most calls as it expects the character before the cursor to be a triggerCharacter.
@deathaxe can you think of a way to detect manually invoked completions? I think that's a fairly safe step forward for now.
As for your second suggestion, I like seeing sublime's word completions as they are often relevant and/or confirm that I'm typing the symbol correctly. Perhaps we can still return word completions and replaced with LSP completions when they arrive?
from lsp.
@philippotto ctrl+space is already hooked up, ...
With "hooked up" you mean that it's a default keybinding of ST? We we could either override it or choose another keybinding? I think this is the easiest way to distinguish between manually and automatically invoked completions. But maybe there's another way..
I like seeing sublime's word completions as they are often relevant and/or confirm that I'm typing the symbol correctly. Perhaps we can still return word completions and replaced with LSP completions when they arrive?
Totally agree. I like ST's fast completions and wouldn't want it to be aggravated by an extension. Adding the LSP completions when they arrive sounds good, but I'd suggest to add them to the bottom of the already provided list. Otherwise, the user might have already navigated in the list of completions and then the entire list gets replaced, which would be annoying.
from lsp.
Perhaps we can still return word completions and replaced with LSP completions when they arrive?
-
Sublime Text merges all completions from plugins/sublime-completions/words in this order of priority. A plugin has the ability to tell ST to skip explicit and or word-completions (see: https://www.sublimetext.com/docs/3/api_reference.html#sublime_plugin.EventListener)
-
Doing so will in most cases result flickering as simply returning None in on_query_completions() will show completions from sublime-completions/words and some milliseconds later it will reopen with the results from language-server. Try Anacoda, then you'll know what I mean. It is just a terrible feeling.
So the only two solutions from my point of view are:
- block and wait for results from language-server
- cancel completion and call show_completions if response arrived.
To handle automatic/manual completions, we may modify the "auto_complete" view setting to disable automatic completions, but I didn't check that right now.
from lsp.
Both word and manual completions are now enabled, hoping to iron out the remaining issues in the near future!
from lsp.
I stil need to write my own triggers per language, right?
from lsp.
Yes, for non-alphabetic characters.
LSP should honour manual completions (ctr+space
) by default, if you want to try if a given trigger character gives good results with your language server.
from lsp.
Related Issues (20)
- Remove obsolete dependencies HOT 4
- Lsp-Omnisharp Code Actions does not work
- CodeLens does not process the whole file after opening it. HOT 2
- Refactor/Rename unavailable for function name HOT 2
- Goto Symbol boots slowly on large files, first characters are inserted in the code as a result HOT 6
- Code Lenses duplicate on creating "Split View" HOT 1
- Investigate using `NO_UNDO` flag for regions
- Some Haskell code actions are not applied "due to non-matching document version" HOT 3
- Provide a way to save all modified files after applying workspace edits HOT 1
- goto definition cursor position is one char behind HOT 6
- Crash when removing a folder from sublime HOT 7
- setting for 'diagnostics' hover popup HOT 2
- Containerized development workflow HOT 3
- Keep server running without a related source file open? HOT 6
- Latest version breaks on startup HOT 2
- [clangd] Duplicated references HOT 6
- Find references not working across the project but only on opened files HOT 8
- Sublime Text Becomes unresponsive when hovered on variable containing large data (Variable Storing embeded font data) HOT 16
- `KeyError` in LSP plugin when trying to open Preferences HOT 3
- Goto Definition throws HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lsp.