From d61fdf6028f3eadc4065182162555ae6dcaa0d48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 16 Jan 2019 16:59:11 +0800 Subject: =?UTF-8?q?=E5=A4=84=E7=90=86=E5=85=B3=E9=97=AD=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/method/textDocument/didClose.lua | 2 +- server/src/service.lua | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'server') 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 -- cgit v1.2.3