-
-
Notifications
You must be signed in to change notification settings - Fork 357
Fix backwards compatability with Lua.workspace.checkThirdParty
#2406
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
I attempted to maintain backwards compatability in LuaLS#2354 but didn't fully understand the config type system.
Thank you! |
Hi @9999years @sumneko , Reading the code, I believe when lua-language-server/script/config/config.lua Lines 56 to 71 in 8e880ad
Since lua-language-server/script/config/template.lua Lines 81 to 85 in 8e880ad
And it is an enum as well so lua-language-server/script/config/template.lua Lines 27 to 44 in 8e880ad
Related: #2407 |
Hmm, this is unfortunate. I'm not sure if there's a way around this other than extending the configuration type system. |
I guess if you want to preserve backwards compatibility, the best way would be to inject hardcoded converter inside this function.
if key == ... and type(value) == "boolean" then
value = value and "Apply" or "Disable"
end Or, actually keep If it is hard to keep backwards compatibility I believe this should be announced as a breaking change since a lot of people depend on this option (at least in neovim community I hear a lot of people using setting this option to |
Yeah, I'll support reverting these changes until we can figure out the backwards compatibility story. |
Actually, I do like your change and if we can keep backwards compat, I will be happy to have the option. If there is a way to notify breaking changes, or we could somehow write a workaround, it'll be awesome but I'd like to hand it to the core developers. |
Have you tried |
I attempted to maintain backwards compatability in LuaLS#2354 and LuaLS#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`.
I attempted to maintain backwards compatibility in #2354 but didn't fully understand the config type system. Here I checked for the booleans
true
andfalse
:lua-language-server/script/library.lua
Lines 611 to 617 in 3bbc8dd
But the config value is now defined as a string:
lua-language-server/script/config/template.lua
Lines 320 to 325 in 5a763b0
So when the config is loaded as a boolean, it gets converted to a string:
lua-language-server/script/config/template.lua
Lines 81 to 85 in 5a763b0
We can fix this by checking for the string values
'true'
and'false'
, rather than the boolean valuestrue
andfalse
.