diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-20 17:30:16 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-20 17:30:16 +0800 |
commit | 64e1114725a8956ac9f280b923fc8eacb0f07265 (patch) | |
tree | cb0afc0fd86acd729a117fc03b9c2c2074cf87ec /server/src/method/workspace | |
parent | e75a364e400a3e394d3ff557523a99ab9880619d (diff) | |
download | lua-language-server-64e1114725a8956ac9f280b923fc8eacb0f07265.zip |
不监视文件变化
Diffstat (limited to 'server/src/method/workspace')
-rw-r--r-- | server/src/method/workspace/didChangeWatchedFiles.lua | 8 |
1 files changed, 7 insertions, 1 deletions
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 |