commit 52823616bc4d77898ddc03da7629280841d3bced
parent ca243f06dd055adff3749a89fce489524eb59ab8
Author: Yi Ming <ofseed@foxmail.com>
Date: Fri, 3 May 2024 22:18:55 +0800
fix(lsp): replace bug-prone ternary operation #28627
ref #28624
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/runtime/lua/vim/lsp/inlay_hint.lua b/runtime/lua/vim/lsp/inlay_hint.lua
@@ -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)