summaryrefslogtreecommitdiff
path: root/server/src/service.lua
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-05-13 14:43:37 +0800
committersumneko <sumneko@hotmail.com>2019-05-13 14:43:37 +0800
commitb10e8084f117d14ceb4251bc3a19a0080a8e808a (patch)
tree46ea2081fa4fdc2f1f560baabf3a32bc100cfc79 /server/src/service.lua
parent9948129ec4acfca9e1a83da1fe8ab9d823d75f33 (diff)
downloadlua-language-server-b10e8084f117d14ceb4251bc3a19a0080a8e808a.zip
排除的文件在关闭文件后清除
Diffstat (limited to 'server/src/service.lua')
-rw-r--r--server/src/service.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/server/src/service.lua b/server/src/service.lua
index 94669218..1e97cb5c 100644
--- a/server/src/service.lua
+++ b/server/src/service.lua
@@ -184,6 +184,15 @@ function mt:isDeadText(uri)
end
function mt:open(uri, version, text)
+ if self.workspace then
+ local fileName = self.workspace:uriDecode(uri)
+ if not self.workspace:isLuaFile(fileName) then
+ return
+ end
+ if self.workspace.gitignore(fileName:string()) then
+ log.debug('Open ignored file:', fileName:string())
+ end
+ end
self:saveText(uri, version, text)
local obj = self._file[uri]
if obj then
@@ -196,6 +205,17 @@ function mt:close(uri)
if obj then
obj._openByClient = false
end
+ if self.workspace then
+ local fileName = self.workspace:uriDecode(uri)
+ if not self.workspace:isLuaFile(fileName) then
+ self:removeText(uri)
+ return
+ end
+ if self.workspace.gitignore(fileName:string()) then
+ log.debug('Close ignored file:', fileName:string())
+ self:removeText(uri)
+ end
+ end
end
function mt:isOpen(uri)