From 5487e6b9a5afc852e1cb757157e386a4658a8a82 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 9 Jul 2021 17:54:42 +0200 Subject: Automatically open current file when showing diagnostics This is more consistent with the other lspc functions. --- init.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 3d2bef9..8986139 100644 --- a/init.lua +++ b/init.lua @@ -937,11 +937,12 @@ local lspc_goto_location_methods = { } local function lspc_show_diagnostic(ls, win, line) - local open_file = ls.open_files[win.file.path] - if not open_file then - return win.file.path .. ' not open in ' .. ls.name + if not ls.open_files[win.file.path] then + lspc_open(ls, win, win.file) end + local open_file = ls.open_files[win.file.path] + local diagnostics = open_file.diagnostics if not diagnostics then return win.file.path .. ' has no diagnostics available' -- cgit v1.2.3