mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-09 03:01:31 +08:00
Lazy-load LSP linters, and check b:changedtick before notifying about changes
This commit is contained in:
@@ -65,14 +65,13 @@ function! s:GoToLSPDefinition(linter, options) abort
|
||||
\ ? function('ale#definition#HandleTSServerResponse')
|
||||
\ : function('ale#definition#HandleLSPResponse')
|
||||
|
||||
let l:lsp_details = ale#linter#StartLSP(l:buffer, a:linter, l:Callback)
|
||||
let l:lsp_details = ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback)
|
||||
|
||||
if empty(l:lsp_details)
|
||||
return 0
|
||||
endif
|
||||
|
||||
let l:id = l:lsp_details.connection_id
|
||||
let l:root = l:lsp_details.project_root
|
||||
|
||||
if a:linter.lsp is# 'tsserver'
|
||||
let l:message = ale#lsp#tsserver_message#Definition(
|
||||
@@ -83,7 +82,7 @@ function! s:GoToLSPDefinition(linter, options) abort
|
||||
else
|
||||
" Send a message saying the buffer has changed first, or the
|
||||
" definition position probably won't make sense.
|
||||
call ale#lsp#Send(l:id, ale#lsp#message#DidChange(l:buffer), l:root)
|
||||
call ale#lsp#NotifyForChanges(l:lsp_details)
|
||||
|
||||
let l:column = min([l:column, len(getline(l:line))])
|
||||
|
||||
@@ -93,7 +92,7 @@ function! s:GoToLSPDefinition(linter, options) abort
|
||||
let l:message = ale#lsp#message#Definition(l:buffer, l:line, l:column)
|
||||
endif
|
||||
|
||||
let l:request_id = ale#lsp#Send(l:id, l:message, l:root)
|
||||
let l:request_id = ale#lsp#Send(l:id, l:message, l:lsp_details.project_root)
|
||||
|
||||
let s:go_to_definition_map[l:request_id] = {
|
||||
\ 'open_in_tab': get(a:options, 'open_in_tab', 0),
|
||||
|
||||
Reference in New Issue
Block a user