From 01800a23addb52788265e0349f519556dab41301 Mon Sep 17 00:00:00 2001 From: Dalius Dobravolskas Date: Sat, 14 Nov 2020 12:15:17 +0200 Subject: Support for LSP/tsserver Code Actions (#3437) * Added tsserver and LSP code action support. * tsserver refactors support added. * Handling special case when new text is added after new line symbol. * ale#code_action#ApplyChanges simplified. * Initial attempt on LSP Code Actions. * workspace/executeCommand added. * Some null checks added. * Add last column to LSP Code Action message. * Pass diagnostics to LSP code action. Previously ApplyChanges code was applied from top-to-bottom that required extra parameters to track progress and there was bug. I have changed code to bottom-to-top approach as that does not require those extra parameters and solved the bug. Tested with typescript-language-server and it is working. --- plugin/ale.vim | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugin') diff --git a/plugin/ale.vim b/plugin/ale.vim index 32ec14ac..7472ea8c 100644 --- a/plugin/ale.vim +++ b/plugin/ale.vim @@ -240,6 +240,8 @@ command! -bar ALEImport :call ale#completion#Import() " Rename symbols using tsserver and LSP command! -bar -bang ALERename :call ale#rename#Execute({'force_save': '' is# '!'}) +command! -bar -range ALECodeAction :call ale#codefix#Execute() + " Organize import statements using tsserver command! -bar ALEOrganizeImports :call ale#organize_imports#Execute() @@ -283,6 +285,7 @@ nnoremap (ale_documentation) :ALEDocumentation inoremap (ale_complete) :ALEComplete nnoremap (ale_import) :ALEImport nnoremap (ale_rename) :ALERename +nnoremap (ale_code_action) :ALECodeAction nnoremap (ale_repeat_selection) :ALERepeatSelection " Set up autocmd groups now. -- cgit v1.2.3