From 2cd8c87b5c6e95c2240f9acfcb5a0ce48a500705 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Sun, 14 May 2017 19:38:46 -0700 Subject: [PATCH] Bug fix: Handle diagnostics for unopened files Ther server may send diagnostics for files that aren't open in any buffer so getbufinfo will return an empty list. --- CHANGELOG.md | 4 +++- autoload/lsc/util.vim | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50091c53..88e8b421 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/autoload/lsc/util.vim b/autoload/lsc/util.vim index 0a572089..e3d7002e 100644 --- a/autoload/lsc/util.vim +++ b/autoload/lsc/util.vim @@ -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