From 81607f4e63c7b513f52a19eb6e399b87354463e9 Mon Sep 17 00:00:00 2001
From: Rebecca Turner <rbt@sent.as>
Date: Wed, 8 Nov 2023 18:33:10 -0800
Subject: [PATCH] Fix backwards compatability with
 `Lua.workspace.checkThirdParty`

I attempted to maintain backwards compatability in #2354 and #2406 but
didn't fully understand the config type system.

This approach uses `Type.Or` and I even tested it to confirm that it
works!

Thanks to @pysan3 for pointing out how a default would be used for
invalid types and to @sumneko for pointing out `Type.Or`.
---
 script/config/template.lua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/script/config/template.lua b/script/config/template.lua
index 6919efa8f..ba0fd503b 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' << {
-- 
GitLab