Skip to content

Commit

Permalink
improve filewatch
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Feb 3, 2023
1 parent 42bad3f commit 514403f
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions script/workspace/workspace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 514403f

Please sign in to comment.