summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-16 16:59:11 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-16 16:59:11 +0800
commitd61fdf6028f3eadc4065182162555ae6dcaa0d48 (patch)
treec4395518abcfd032f96113d94e1d025edb71d189 /server
parent137bcd30a978ab67994dacdfd83b8cb88d5df6a3 (diff)
downloadlua-language-server-d61fdf6028f3eadc4065182162555ae6dcaa0d48.zip
处理关闭文件
Diffstat (limited to 'server')
-rw-r--r--server/src/method/textDocument/didClose.lua2
-rw-r--r--server/src/service.lua13
2 files changed, 10 insertions, 5 deletions
diff --git a/server/src/method/textDocument/didClose.lua b/server/src/method/textDocument/didClose.lua
index 5da33010..7d097407 100644
--- a/server/src/method/textDocument/didClose.lua
+++ b/server/src/method/textDocument/didClose.lua
@@ -1,6 +1,6 @@
return function (lsp, params)
local doc = params.textDocument
- --lsp:removeText(doc.uri, doc.version)
+ lsp:removeText(doc.uri, doc.version)
lsp:close(doc.uri)
return true
end
diff --git a/server/src/service.lua b/server/src/service.lua
index 528bc644..376fd2c3 100644
--- a/server/src/service.lua
+++ b/server/src/service.lua
@@ -237,6 +237,15 @@ function mt:readText(uri, path)
self:needCompile(uri)
end
+function mt:removeText(uri)
+ local obj = self._file[uri]
+ if obj then
+ return
+ end
+ obj.version = -1
+ self:clearDiagnostics(uri)
+end
+
function mt:open(uri)
self._opening[uri] = true
end
@@ -403,10 +412,6 @@ function mt:compileChain(child, parent)
childObj.parent[parent] = true
end
-function mt:removeText(uri)
- self._file[uri] = nil
-end
-
function mt:checkWorkSpaceComplete()
if self._hasCheckedWorkSpaceComplete then
return