summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-11-09 10:47:19 +0800
committerGitHub <noreply@github.com>2023-11-09 10:47:19 +0800
commit0e1b109c510bcb414b809e1da7c1e2993ee55776 (patch)
tree548112ee41b9fdd262d86cbe4d5caa985380d58f
parent8e880ad5eee0178e32819819eef315d462f4ae65 (diff)
parent81607f4e63c7b513f52a19eb6e399b87354463e9 (diff)
downloadlua-language-server-0e1b109c510bcb414b809e1da7c1e2993ee55776.zip
Merge pull request #2409 from 9999years/fix-back-compat-take-2
Fix backwards compatability with `Lua.workspace.checkThirdParty` (take 2!)
-rw-r--r--script/config/template.lua4
-rw-r--r--script/library.lua8
2 files changed, 4 insertions, 8 deletions
diff --git a/script/config/template.lua b/script/config/template.lua
index 6919efa8..ba0fd503 100644
--- a/script/config/template.lua
+++ b/script/config/template.lua
@@ -317,12 +317,12 @@ local template = {
['Lua.workspace.maxPreload'] = Type.Integer >> 5000,
['Lua.workspace.preloadFileSize'] = Type.Integer >> 500,
['Lua.workspace.library'] = Type.Array(Type.String),
- ['Lua.workspace.checkThirdParty'] = Type.String >> 'Ask' << {
+ ['Lua.workspace.checkThirdParty'] = Type.Or(Type.String >> 'Ask' << {
'Ask',
'Apply',
'ApplyInMemory',
'Disable',
- },
+ }, Type.Boolean),
['Lua.workspace.userThirdParty'] = Type.Array(Type.String),
['Lua.completion.enable'] = Type.Boolean >> true,
['Lua.completion.callSnippet'] = Type.String >> 'Disable' << {
diff --git a/script/library.lua b/script/library.lua
index 290b5b33..4446797a 100644
--- a/script/library.lua
+++ b/script/library.lua
@@ -610,13 +610,9 @@ local function check3rd(uri)
end
local checkThirdParty = config.get(uri, 'Lua.workspace.checkThirdParty')
-- Backwards compatability: `checkThirdParty` used to be a boolean.
- -- Note: `checkThirdParty` is defined as a string, so if a boolean is
- -- supplied, it's converted to a string by the `config.config` module.
- -- Hence we check for the strings `'true'` and `'false`' here, rather than
- -- the boolean literals.
- if checkThirdParty == 'Disable' or checkThirdParty == 'false' then
+ if not checkThirdParty or checkThirdParty == 'Disable' then
return
- elseif checkThirdParty == 'true' then
+ elseif checkThirdParty == true then
checkThirdParty = 'Ask'
end
local scp = scope.getScope(uri)