Fix :ALEImport column position

Fix :ALEImport column position so it works with more language servers.

Co-authored-by: w0rp <devw0rp@gmail.com>
This commit is contained in:
yoshi1123 2022-03-20 09:20:33 -04:00 committed by w0rp
parent 560e6340ce
commit 7e2342ab52
No known key found for this signature in database
GPG Key ID: 0FC1ECAA8C81CD83
2 changed files with 14 additions and 13 deletions

View File

@ -911,7 +911,8 @@ function! ale#completion#Import() abort
endif
let [l:line, l:column] = getpos('.')[1:2]
let l:column = searchpos('\V' . escape(l:word, '/\'), 'bn', l:line)[1]
let l:column = searchpos('\V' . escape(l:word, '/\'), 'bnc', l:line)[1]
let l:column = l:column + len(l:word) - 1
if l:column isnot 0
let l:started = ale#completion#GetCompletions('ale-import', {

View File

@ -187,7 +187,7 @@ Execute(ALEImport should request imports correctly for tsserver):
\ 'conn_id': 0,
\ 'request_id': 0,
\ 'source': 'ale-import',
\ 'column': 11,
\ 'column': 21,
\ 'line': 2,
\ 'line_length': 21,
\ 'prefix': 'missingword',
@ -206,7 +206,7 @@ Execute(ALEImport should request imports correctly for tsserver):
\ 'conn_id': 347,
\ 'request_id': 1,
\ 'source': 'ale-import',
\ 'column': 11,
\ 'column': 21,
\ 'line': 2,
\ 'line_length': 21,
\ 'prefix': 'missingword',
@ -229,14 +229,14 @@ Execute(ALEImport should request imports correctly for tsserver):
\ [0, 'ts@completions', {
\ 'file': expand('%:p'),
\ 'includeExternalModuleExports': 1,
\ 'offset': 11,
\ 'offset': 21,
\ 'line': 2,
\ 'prefix': 'missingword',
\ }],
\ [0, 'ts@completionEntryDetails', {
\ 'file': expand('%:p'),
\ 'entryNames': [{'name': 'missingword'}],
\ 'offset': 11,
\ 'offset': 21,
\ 'line': 2,
\ }]
\ ],
@ -282,7 +282,7 @@ Execute(ALEImport should tell the user when no completions were found from tsser
\ 'conn_id': 0,
\ 'request_id': 0,
\ 'source': 'ale-import',
\ 'column': 11,
\ 'column': 21,
\ 'line': 2,
\ 'line_length': 21,
\ 'prefix': 'missingword',
@ -301,7 +301,7 @@ Execute(ALEImport should tell the user when no completions were found from tsser
\ 'conn_id': 347,
\ 'request_id': 1,
\ 'source': 'ale-import',
\ 'column': 11,
\ 'column': 21,
\ 'line': 2,
\ 'line_length': 21,
\ 'prefix': 'missingword',
@ -336,7 +336,7 @@ Execute(ALEImport should request imports correctly for language servers):
\ 'conn_id': 0,
\ 'request_id': 0,
\ 'source': 'ale-import',
\ 'column': 7,
\ 'column': 17,
\ 'line': 2,
\ 'line_length': 17,
\ 'prefix': 'missingword',
@ -355,7 +355,7 @@ Execute(ALEImport should request imports correctly for language servers):
\ 'conn_id': 347,
\ 'request_id': 1,
\ 'source': 'ale-import',
\ 'column': 7,
\ 'column': 17,
\ 'line': 2,
\ 'line_length': 17,
\ 'prefix': 'missingword',
@ -369,7 +369,7 @@ Execute(ALEImport should request imports correctly for language servers):
\ [
\ [0, 'textDocument/completion', {
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
\ 'position': {'character': 6, 'line': 1}
\ 'position': {'character': 16, 'line': 1}
\ }],
\ ],
\ g:sent_message_list
@ -482,7 +482,7 @@ Execute(ALEImport should tell the user when no completions were found from a lan
\ 'conn_id': 0,
\ 'request_id': 0,
\ 'source': 'ale-import',
\ 'column': 7,
\ 'column': 17,
\ 'line': 2,
\ 'line_length': 17,
\ 'prefix': 'missingword',
@ -501,7 +501,7 @@ Execute(ALEImport should tell the user when no completions were found from a lan
\ 'conn_id': 347,
\ 'request_id': 1,
\ 'source': 'ale-import',
\ 'column': 7,
\ 'column': 17,
\ 'line': 2,
\ 'line_length': 17,
\ 'prefix': 'missingword',
@ -515,7 +515,7 @@ Execute(ALEImport should tell the user when no completions were found from a lan
\ [
\ [0, 'textDocument/completion', {
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
\ 'position': {'character': 6, 'line': 1}
\ 'position': {'character': 16, 'line': 1}
\ }],
\ ],
\ g:sent_message_list