@@ -383,13 +383,13 @@ local function apply3rd(uri, cfg, onlyMemory)
383
383
client .setConfig (changes , onlyMemory )
384
384
end
385
385
386
- local hasAsked
386
+ local hasAsked = {}
387
387
--- @async
388
388
local function askFor3rd (uri , cfg )
389
- if hasAsked then
389
+ if hasAsked [ cfg . name ] then
390
390
return nil
391
391
end
392
- hasAsked = true
392
+ hasAsked [ cfg . name ] = true
393
393
local yes1 = lang .script .WINDOW_APPLY_WHIT_SETTING
394
394
local yes2 = lang .script .WINDOW_APPLY_WHITOUT_SETTING
395
395
local no = lang .script .WINDOW_DONT_SHOW_AGAIN
@@ -402,24 +402,8 @@ local function askFor3rd(uri, cfg)
402
402
end
403
403
if result == yes1 then
404
404
apply3rd (uri , cfg , false )
405
- client .setConfig ({
406
- {
407
- key = ' Lua.workspace.checkThirdParty' ,
408
- action = ' set' ,
409
- value = false ,
410
- uri = uri ,
411
- },
412
- }, false )
413
405
elseif result == yes2 then
414
406
apply3rd (uri , cfg , true )
415
- client .setConfig ({
416
- {
417
- key = ' Lua.workspace.checkThirdParty' ,
418
- action = ' set' ,
419
- value = false ,
420
- uri = uri ,
421
- },
422
- }, true )
423
407
else
424
408
client .setConfig ({
425
409
{
@@ -450,9 +434,6 @@ local function wholeMatch(a, b)
450
434
end
451
435
452
436
local function check3rdByWords (uri , configs )
453
- if hasAsked then
454
- return
455
- end
456
437
if not files .isLua (uri ) then
457
438
return
458
439
end
@@ -465,23 +446,32 @@ local function check3rdByWords(uri, configs)
465
446
return
466
447
end
467
448
for _ , cfg in ipairs (configs ) do
468
- if cfg .words then
469
- for _ , word in ipairs (cfg .words ) do
470
- await .delay ()
471
- if wholeMatch (text , word ) then
449
+ if not cfg .words then
450
+ goto CONTINUE
451
+ end
452
+ if hasAsked [cfg .name ] then
453
+ goto CONTINUE
454
+ end
455
+ local library = (' %s/library' ):format (cfg .dirname )
456
+ if util .arrayHas (config .get (uri , ' Lua.workspace.library' ), library ) then
457
+ goto CONTINUE
458
+ end
459
+ for _ , word in ipairs (cfg .words ) do
460
+ await .delay ()
461
+ if wholeMatch (text , word ) then
462
+ --- @async
463
+ await .call (function ()
472
464
askFor3rd (uri , cfg )
473
- return
474
- end
465
+ end )
466
+ return
475
467
end
476
468
end
469
+ :: CONTINUE::
477
470
end
478
471
end , id )
479
472
end
480
473
481
474
local function check3rdByFileName (uri , configs )
482
- if hasAsked then
483
- return
484
- end
485
475
local path = ws .getRelativePath (uri )
486
476
if not path then
487
477
return
@@ -491,24 +481,29 @@ local function check3rdByFileName(uri, configs)
491
481
await .call (function () --- @async
492
482
await .sleep (0.1 )
493
483
for _ , cfg in ipairs (configs ) do
494
- if cfg .files then
495
- for _ , filename in ipairs (cfg .files ) do
496
- await .delay ()
497
- if wholeMatch (path , filename ) then
484
+ if not cfg .files then
485
+ goto CONTINUE
486
+ end
487
+ if hasAsked [cfg .name ] then
488
+ goto CONTINUE
489
+ end
490
+ for _ , filename in ipairs (cfg .files ) do
491
+ await .delay ()
492
+ if wholeMatch (path , filename ) then
493
+ --- @async
494
+ await .call (function ()
498
495
askFor3rd (uri , cfg )
499
- return
500
- end
496
+ end )
497
+ return
501
498
end
502
499
end
500
+ :: CONTINUE::
503
501
end
504
502
end , id )
505
503
end
506
504
507
505
--- @async
508
506
local function check3rd (uri )
509
- if hasAsked then
510
- return
511
- end
512
507
if ws .isIgnored (uri ) then
513
508
return
514
509
end
0 commit comments