summaryrefslogtreecommitdiff
path: root/script/workspace
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-01-31 16:12:32 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-01-31 16:12:32 +0800
commit996d46fcf80cedbc64b4f76fa772a1dcc1f567e6 (patch)
tree673a80438664074462ebb5a8b4d8eb9f7701d44b /script/workspace
parent26b94a3743cf264ec2fad975f95c33069b37c4e3 (diff)
downloadlua-language-server-996d46fcf80cedbc64b4f76fa772a1dcc1f567e6.zip
watch symbolic links
resolve #1848
Diffstat (limited to 'script/workspace')
-rw-r--r--script/workspace/workspace.lua17
1 files changed, 14 insertions, 3 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index 7031064b..fd2e8f31 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -231,7 +231,6 @@ function m.getLibraryMatchers(scp)
end
--- 文件是否被忽略
----@async
---@param uri uri
function m.isIgnored(uri)
local scp = scope.getScope(uri)
@@ -308,7 +307,13 @@ function m.awaitPreload(scp)
if scp.uri and not scp:get('bad root') then
log.info('Scan files at:', scp:getName())
- scp:gc(fw.watch(m.normalize(furi.decode(scp.uri)), true))
+ scp:gc(fw.watch(m.normalize(furi.decode(scp.uri)), true, function (path)
+ local uri = furi.encode(path)
+ if m.isIgnored(uri) and not files.isLibrary(uri) then
+ return false
+ end
+ return true
+ end))
local count = 0
---@async
native:scan(furi.decode(scp.uri), function (path)
@@ -326,7 +331,13 @@ function m.awaitPreload(scp)
for _, libMatcher in ipairs(librarys) do
log.info('Scan library at:', libMatcher.uri)
local count = 0
- scp:gc(fw.watch(furi.decode(libMatcher.uri), true))
+ scp:gc(fw.watch(furi.decode(libMatcher.uri), true, function (path)
+ local uri = furi.encode(path)
+ if m.isIgnored(uri) and not files.isLibrary(uri) then
+ return false
+ end
+ return true
+ end))
scp:addLink(libMatcher.uri)
---@async
libMatcher.matcher:scan(furi.decode(libMatcher.uri), function (path)