fix(lsp): replace bug-prone ternary operation #28627

ref #28624
This commit is contained in:
Yi Ming 2024-05-03 22:18:55 +08:00 committed by GitHub
parent ca243f06dd
commit 52823616bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -20,7 +20,11 @@ local bufstates = vim.defaulttable(function(_)
return setmetatable({ applied = {} }, {
__index = globalstate,
__newindex = function(state, key, value)
rawset(state, key, (globalstate[key] ~= value) and value or nil)
if globalstate[key] == value then
rawset(state, key, nil)
else
rawset(state, key, value)
end
end,
})
end)