Skip to content

Commit

Permalink
Bug fix: Handle diagnostics for unopened files
Browse files Browse the repository at this point in the history
Ther server may send diagnostics for files that aren't open in any
buffer so getbufinfo will return an empty list.
  • Loading branch information
natebosch committed May 15, 2017
1 parent f0e1f62 commit 2cd8c87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# 0.1.3-dev
# 0.1.3

- Bug fix: Newlines in diagnostics are replace with '\n' to avoid multiline
messages
- Add support for `textDocument/references` request. References are shown in
quickfix list.
- Bug fix: Support receiving diagnostics for files which are not opened in a
buffer

# 0.1.2

Expand Down
7 changes: 5 additions & 2 deletions autoload/lsc/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ 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)
let bufinfo = getbufinfo(a:file_path)
if len(bufinfo) < 1
return []
endif
return copy(bufinfo[0].windows)
endfunction

0 comments on commit 2cd8c87

Please sign in to comment.