summaryrefslogtreecommitdiff
path: root/script/workspace
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-10-23 00:21:32 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-10-23 00:21:32 +0800
commit137d40a9fcf7690820914a91c492ef4881ddc250 (patch)
treec590ccea64ad14d0729a5a90df84f63529b9baaf /script/workspace
parent416b7a8ab67c4cb9576eb61b63631bc3d23131e4 (diff)
downloadlua-language-server-137d40a9fcf7690820914a91c492ef4881ddc250.zip
filewatch before scanning workspace
fix #1640
Diffstat (limited to 'script/workspace')
-rw-r--r--script/workspace/workspace.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index 272ceb0e..2e6e8652 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -308,6 +308,7 @@ 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))))
local count = 0
---@async
native:scan(furi.decode(scp.uri), function (path)
@@ -320,12 +321,12 @@ function m.awaitPreload(scp)
client.showMessage('Warning', lang.script('WORKSPACE_SCAN_TOO_MUCH', count, furi.decode(scp.uri)))
end
end)
- scp:gc(fw.watch(m.normalize(furi.decode(scp.uri))))
end
for _, libMatcher in ipairs(librarys) do
log.info('Scan library at:', libMatcher.uri)
local count = 0
+ scp:gc(fw.watch(furi.decode(libMatcher.uri)))
scp:addLink(libMatcher.uri)
---@async
libMatcher.matcher:scan(furi.decode(libMatcher.uri), function (path)
@@ -338,7 +339,6 @@ function m.awaitPreload(scp)
client.showMessage('Warning', lang.script('WORKSPACE_SCAN_TOO_MUCH', count, furi.decode(libMatcher.uri)))
end
end)
- scp:gc(fw.watch(furi.decode(libMatcher.uri)))
end
-- must wait for other scopes to add library