diff options
author | Jesse <github@jessebakker.com> | 2020-05-16 01:18:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-16 01:18:59 +0200 |
commit | f559e5249e3aa155687b335272da8f0c73255ee4 (patch) | |
tree | 1f2ebdabff710220c717011c57d386fae2cdfd17 /runtime/lua/vim/lsp/buf.lua | |
parent | c37d9fa3da3cea303915f29e75665f50c4c13b41 (diff) | |
download | rneovim-f559e5249e3aa155687b335272da8f0c73255ee4.tar.gz rneovim-f559e5249e3aa155687b335272da8f0c73255ee4.tar.bz2 rneovim-f559e5249e3aa155687b335272da8f0c73255ee4.zip |
LSP: Add textDocument/codeAction support (#11607)
* Add textDocument/codeAction
* Add callback for workspace/executeCommand
* Escape newlines in codeAction titles
* Return empty list in get_line_diagnostics if no buffer diagnostics
* Add stub documentation
* Validate context parameter in code_action
* Add support for edit in CodeAction responses
* Group diagnostics by line in vim.lsp.util.get_line_diagnostics()
* Advertise code action literal support
Diffstat (limited to 'runtime/lua/vim/lsp/buf.lua')
-rw-r--r-- | runtime/lua/vim/lsp/buf.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 0b45951a56..7a819f3c3d 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -161,5 +161,21 @@ function M.clear_references() util.buf_clear_references() end +function M.code_action(context) + validate { context = { context, 't', true } } + context = context or { diagnostics = util.get_line_diagnostics() } + local params = util.make_range_params() + params.context = context + request('textDocument/codeAction', params) +end + +function M.execute_command(command) + validate { + command = { command.command, 's' }, + arguments = { command.arguments, 't', true } + } + request('workspace/executeCommand', command) +end + return M -- vim:sw=2 ts=2 et |