File tree Expand file tree Collapse file tree 2 files changed +20
-24
lines changed Expand file tree Collapse file tree 2 files changed +20
-24
lines changed Original file line number Diff line number Diff line change @@ -134,23 +134,18 @@ function mt:loadFile(uri, libraryUri)
134
134
await .delay ()
135
135
end
136
136
137
- function mt :loadStashed (max )
138
- for _ = 1 , max do
139
- local loader = table.remove (self ._stash )
140
- if not loader then
141
- return
142
- end
143
- await .call (loader )
144
- end
145
- end
146
-
147
137
--- @async
148
138
function mt :loadAll ()
149
139
while self .read < self .max do
150
140
log .info ((' Loaded %d/%d files' ):format (self .read , self .max ))
151
- self :loadStashed (100 )
152
141
self :update ()
153
- await .sleep (0.1 )
142
+ local loader = table.remove (self ._stash )
143
+ if loader then
144
+ await .call (loader )
145
+ await .delay ()
146
+ else
147
+ await .sleep (0.1 )
148
+ end
154
149
end
155
150
log .info (' Loaded finish.' )
156
151
end
Original file line number Diff line number Diff line change @@ -491,10 +491,11 @@ end)
491
491
492
492
fw .event (function (changes ) --- @async
493
493
for _ , change in ipairs (changes ) do
494
+ local path = change .path
495
+ local uri = furi .encode (path )
496
+
494
497
--- @async
495
498
await .call (function ()
496
- local path = change .path
497
- local uri = furi .encode (path )
498
499
if change .type == ' create' then
499
500
log .debug (' FileChangeType.Created' , uri )
500
501
m .awaitLoadFile (uri )
@@ -514,19 +515,19 @@ fw.event(function (changes) ---@async
514
515
if not files .isOpen (uri ) then
515
516
files .setText (uri , pub .awaitTask (' loadFile' , furi .decode (uri )), false )
516
517
end
517
- else
518
- local filename = fs .path (path ):filename ():string ()
519
- -- 排除类文件发生更改需要重新扫描
520
- if filename == ' .gitignore'
521
- or filename == ' .gitmodules' then
522
- local scp = scope .getScope (uri )
523
- if scp .type ~= ' fallback' then
524
- m .reload (scp )
525
- end
526
- end
527
518
end
528
519
end
529
520
end )
521
+
522
+ local filename = fs .path (path ):filename ():string ()
523
+ -- 排除类文件发生更改需要重新扫描
524
+ if filename == ' .gitignore'
525
+ or filename == ' .gitmodules' then
526
+ local scp = scope .getScope (uri )
527
+ if scp .type ~= ' fallback' then
528
+ m .reload (scp )
529
+ end
530
+ end
530
531
end
531
532
end )
532
533
You can’t perform that action at this time.
0 commit comments