diff --git a/CHANGELOG.md b/CHANGELOG.md index 553c69e4..627b2933 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Avoid completion requests while already giving suggestions - Improve heuristics for start of completion range - Flush file changes after completion +- Bug fix: Don't change window highlights when in select mode # 0.1.1 diff --git a/autoload/lsc/diagnostics.vim b/autoload/lsc/diagnostics.vim index 372b38ee..750eca94 100644 --- a/autoload/lsc/diagnostics.vim +++ b/autoload/lsc/diagnostics.vim @@ -71,22 +71,22 @@ function! lsc#diagnostics#setForFile(file_path, diagnostics) abort call add(diagnostics_by_line[diagnostic.range[0]], diagnostic) endfor let s:file_diagnostics[a:file_path] = diagnostics_by_line - call lsc#util#winDo('call lsc#diagnostics#update("'.a:file_path.'")') + call lsc#highlights#updateDisplayed() + call lsc#diagnostics#updateLocationList(a:file_path) endfunction -" Updates highlighting and location list for the current window if it matches -" [file_path] -function! lsc#diagnostics#update(file_path) abort - if a:file_path != expand('%:p') | return | endif - call lsc#highlights#update() - let bufnr = bufnr('%') +" Updates location list for all windows showing [file_path]. +function! lsc#diagnostics#updateLocationList(file_path) abort + let bufnr = bufnr(a:file_path) let items = [] - for line in values(lsc#diagnostics#forFile(a:file_path)) + for line in values(lsc#diagnostics#forFile(expand('%:p'))) for diagnostic in line call add(items, s:locationListItem(bufnr, diagnostic)) endfor endfor - call setloclist(0, items) + for window in lsc#util#windowsForFile(a:file_path) + call setloclist(window, items) + endfor endfunction " Finds the first diagnostic which is under the cursor on the current line. If diff --git a/autoload/lsc/util.vim b/autoload/lsc/util.vim index 300a13e8..0a572089 100644 --- a/autoload/lsc/util.vim +++ b/autoload/lsc/util.vim @@ -58,3 +58,10 @@ function! s:Callback(group) call s:callbacks[a:group][0]() unlet s:callbacks[a:group] endfunction + +" Returns the window IDs of the windows showing the buffer opened for +" [file_path]. +function! lsc#util#windowsForFile(file_path) abort + let bufinfo = getbufinfo(a:file_path)[0] + return copy(bufinfo.windows) +endfunction