Add CodeAction codeActionLiteralSupport Feature (#4163)

* Advertise codeActionLiteralSupport to LSP server

Without this, rust-analyzer doesn't return any code actions.  With it,
everything works properly.

* linter fixes

* test cases fixes

* Fix underflow of column in position.

Special values like for example -1 to denote the end of a line are not supported.
[reference](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position)

Co-authored-by: Brian Gernhardt <brian@gernhardtsoftware.com>
This commit is contained in:
godbless 2022-04-29 18:47:29 +05:30 committed by GitHub
parent 6c51bb1573
commit 3348222abc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -457,7 +457,7 @@ function! s:ExecuteGetCodeFix(linter, range, MenuCallback) abort
let [l:end_line, l:end_column] = getpos("'>")[1:2]
endif
let l:column = min([l:column, len(getline(l:line))])
let l:column = max([min([l:column, len(getline(l:line))]), 1])
let l:end_column = min([l:end_column, len(getline(l:end_line))])
let l:Callback = function(

View File

@ -443,6 +443,11 @@ function! s:SendInitMessage(conn) abort
\ },
\ 'codeAction': {
\ 'dynamicRegistration': v:false,
\ 'codeActionLiteralSupport': {
\ 'codeActionKind': {
\ 'valueSet': []
\ }
\ }
\ },
\ 'rename': {
\ 'dynamicRegistration': v:false,

View File

@ -194,6 +194,11 @@ Before:
\ },
\ 'codeAction': {
\ 'dynamicRegistration': v:false,
\ 'codeActionLiteralSupport': {
\ 'codeActionKind': {
\ 'valueSet': []
\ }
\ }
\ },
\ 'rename': {
\ 'dynamicRegistration': v:false,