summaryrefslogtreecommitdiff
path: root/server/src/method
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/method')
-rw-r--r--server/src/method/initialized.lua2
-rw-r--r--server/src/method/workspace/didChangeWatchedFiles.lua14
2 files changed, 13 insertions, 3 deletions
diff --git a/server/src/method/initialized.lua b/server/src/method/initialized.lua
index 47b924d0..1348e03b 100644
--- a/server/src/method/initialized.lua
+++ b/server/src/method/initialized.lua
@@ -17,7 +17,7 @@ local function initAfterConfig(lsp, firstScope)
watchers = {
{
globPattern = '**/',
- kind = 1 | 4,
+ kind = 1 | 2 | 4,
}
},
},
diff --git a/server/src/method/workspace/didChangeWatchedFiles.lua b/server/src/method/workspace/didChangeWatchedFiles.lua
index 7e1afb92..06d840e1 100644
--- a/server/src/method/workspace/didChangeWatchedFiles.lua
+++ b/server/src/method/workspace/didChangeWatchedFiles.lua
@@ -15,11 +15,21 @@ return function (lsp, params)
local path = lsp.workspace:uriDecode(change.uri)
if change.type == FileChangeType.Created then
lsp.workspace:addFile(path)
+ if lsp:getVM(change.uri) then
+ needReset = true
+ end
elseif change.type == FileChangeType.Deleted then
lsp.workspace:removeFile(path)
+ if lsp:getVM(change.uri) then
+ needReset = true
+ end
end
- if lsp:getVM(change.uri) then
- needReset = true
+ -- 排除类文件发生更改需要重新扫描
+ local filename = path:filename():string()
+ if lsp.workspace:fileNameEq(filename, '.gitignore')
+ or lsp.workspace:fileNameEq(filename, '.gitmodules')
+ then
+ lsp:reScanFiles()
end
end
-- 缓存过的文件发生变化后,重新计算