summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-03-10 15:21:36 +0000
committerw0rp <devw0rp@gmail.com>2019-03-10 15:21:36 +0000
commit03384a5d6f966b28efa136056e8b7b1b4f1c3d89 (patch)
tree8fbbb33ecf314ac1281307eac7d3a6783ff00736 /autoload
parent8a0213f1fda005fe436d70e3bcc7b611b73a0855 (diff)
downloadale-03384a5d6f966b28efa136056e8b7b1b4f1c3d89.zip
#2341 - Handle completion messages with textEdit objects
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/completion.vim12
1 files changed, 11 insertions, 1 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index 48fa3963..644fef99 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -39,6 +39,9 @@ let s:LSP_COMPLETION_COLOR_KIND = 16
let s:LSP_COMPLETION_FILE_KIND = 17
let s:LSP_COMPLETION_REFERENCE_KIND = 18
+let s:LSP_INSERT_TEXT_FORMAT_PLAIN = 1
+let s:LSP_INSERT_TEXT_FORMAT_SNIPPET = 2
+
let s:lisp_regex = '\v[a-zA-Z_\-][a-zA-Z_\-0-9]*$'
" Regular expressions for checking the characters in the line before where
@@ -350,7 +353,14 @@ function! ale#completion#ParseLSPCompletions(response) abort
continue
endif
- let l:word = matchstr(l:item.label, '\v^[^(]+')
+ if get(l:item, 'insertTextFormat') is s:LSP_INSERT_TEXT_FORMAT_PLAIN
+ \&& type(get(l:item, 'textEdit')) is v:t_dict
+ let l:text = l:item.textEdit.newText
+ else
+ let l:text = l:item.label
+ endif
+
+ let l:word = matchstr(l:text, '\v^[^(]+')
if empty(l:word)
continue