Skip to content

Commit 0e1b109

Browse files
authored
Merge pull request #2409 from 9999years/fix-back-compat-take-2
Fix backwards compatability with `Lua.workspace.checkThirdParty` (take 2!)
2 parents 8e880ad + 81607f4 commit 0e1b109

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

script/config/template.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,12 @@ local template = {
317317
['Lua.workspace.maxPreload'] = Type.Integer >> 5000,
318318
['Lua.workspace.preloadFileSize'] = Type.Integer >> 500,
319319
['Lua.workspace.library'] = Type.Array(Type.String),
320-
['Lua.workspace.checkThirdParty'] = Type.String >> 'Ask' << {
320+
['Lua.workspace.checkThirdParty'] = Type.Or(Type.String >> 'Ask' << {
321321
'Ask',
322322
'Apply',
323323
'ApplyInMemory',
324324
'Disable',
325-
},
325+
}, Type.Boolean),
326326
['Lua.workspace.userThirdParty'] = Type.Array(Type.String),
327327
['Lua.completion.enable'] = Type.Boolean >> true,
328328
['Lua.completion.callSnippet'] = Type.String >> 'Disable' << {

script/library.lua

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -610,13 +610,9 @@ local function check3rd(uri)
610610
end
611611
local checkThirdParty = config.get(uri, 'Lua.workspace.checkThirdParty')
612612
-- Backwards compatability: `checkThirdParty` used to be a boolean.
613-
-- Note: `checkThirdParty` is defined as a string, so if a boolean is
614-
-- supplied, it's converted to a string by the `config.config` module.
615-
-- Hence we check for the strings `'true'` and `'false`' here, rather than
616-
-- the boolean literals.
617-
if checkThirdParty == 'Disable' or checkThirdParty == 'false' then
613+
if not checkThirdParty or checkThirdParty == 'Disable' then
618614
return
619-
elseif checkThirdParty == 'true' then
615+
elseif checkThirdParty == true then
620616
checkThirdParty = 'Ask'
621617
end
622618
local scp = scope.getScope(uri)

0 commit comments

Comments
 (0)