From 64e1114725a8956ac9f280b923fc8eacb0f07265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 20 Dec 2018 17:30:16 +0800 Subject: =?UTF-8?q?=E4=B8=8D=E7=9B=91=E8=A7=86=E6=96=87=E4=BB=B6=E5=8F=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/method/workspace/didChangeWatchedFiles.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'server/src/method/workspace') diff --git a/server/src/method/workspace/didChangeWatchedFiles.lua b/server/src/method/workspace/didChangeWatchedFiles.lua index ec71250f..df57baff 100644 --- a/server/src/method/workspace/didChangeWatchedFiles.lua +++ b/server/src/method/workspace/didChangeWatchedFiles.lua @@ -8,6 +8,7 @@ return function (lsp, params) if not lsp.workspace then return end + local needReset for _, change in ipairs(params.changes) do if change.type == FileChangeType.Created then lsp.workspace:addFile(change.uri) @@ -16,7 +17,12 @@ return function (lsp, params) -- 删除文件后,清除该文件的诊断 lsp:clearDiagnostics(change.uri) end + if lsp:isOpen(change.uri) then + needReset = true + end end -- 发生任何文件变化后,重新计算当前的打开文件 - lsp.workspace:reset() + if needReset then + lsp.workspace:reset() + end end -- cgit v1.2.3