-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
feat(lsp): completion side effects #27339
Conversation
dfac84c
to
b4e3a8a
Compare
b4e3a8a
to
baf818c
Compare
baf818c
to
0d23409
Compare
0d23409
to
a5ce04f
Compare
674fc48
to
863b329
Compare
runtime/lua/vim/lsp/_completion.lua
Outdated
end | ||
|
||
--- Trigger LSP completion in the current buffer. | ||
function M.trigger_completion() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is mostly called in "scheduled" fashion (via vim.shedule()
or after vim.schedule_wrap()
). Usually it should be possible to do single schedule_wrap()
after defining function instead of all other scheduling in place.
941a60a
to
facf46f
Compare
Okay the implementation is done and tests are all passing. At this point we just need to agree on whether we should enable completion by default and the structure of the public API (so just the usual bikeshedding ;)). Not sure if we want to do that in this PR or in a separate one. Wdyt @mfussenegger @clason @justinmk @gpanders? |
755e769
to
c972f7a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a blocker: did you intend to revert your supports_method
changes in lsp.txt ?
Yeah I didn't want to keep the changes in that file with stuff unrelated to this PR. I plan on doing a better review of the current LSP docs later. |
Closes #25714
This PR introduces
vim.lsp.completion
with the goal of supporting the completion behaviours (snippet expansion, execution of commands, application of text edits) specified by LSP.To enable completions for a given buffer and client, users should call
vim.lsp.completion.enable(true, client_id, bufnr, opts)
. Currently the options parameter includes theautotrigger
property, which when set will request completions after a trigger character has been typed.This PR also sets new default keymaps for the snippet navigation:
<Tab>
will jump to the next tabstop if the snippet is active and jumpable forwards.<S-Tab>
will jump to the previous tabstop if the snippet is active and jumpable backwards.If these keys are being used in other keymaps, they will be restored once the snippet session ends.