diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-02-03 17:23:08 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-02-03 17:23:08 +0800 |
commit | 514403f34821956dccb483aa957f37d266aa3bc3 (patch) | |
tree | 633322cd26642724515a2dbcd0022e0c285b2230 /script/workspace | |
parent | 42bad3f48c65b3a0f99174e07d69c12d12bee5af (diff) | |
download | lua-language-server-514403f34821956dccb483aa957f37d266aa3bc3.zip |
improve filewatch
#1872
Diffstat (limited to 'script/workspace')
-rw-r--r-- | script/workspace/workspace.lua | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 3890044e..ad306beb 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -307,13 +307,11 @@ function m.awaitPreload(scp) if scp.uri and not scp:get('bad root') then log.info('Scan files at:', scp:getName()) - ---@async 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 + local rpath = m.getRelativePath(path) + if native(rpath) then return false end - await.delay() return true end)) local count = 0 @@ -333,13 +331,11 @@ function m.awaitPreload(scp) for _, libMatcher in ipairs(librarys) do log.info('Scan library at:', libMatcher.uri) local count = 0 - ---@async 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 + local rpath = m.getRelativePath(path) + if libMatcher.matcher(rpath) then return false end - await.delay() return true end)) scp:addLink(libMatcher.uri) |