From 52823616bc4d77898ddc03da7629280841d3bced Mon Sep 17 00:00:00 2001 From: Yi Ming Date: Fri, 3 May 2024 22:18:55 +0800 Subject: fix(lsp): replace bug-prone ternary operation #28627 ref #28624 --- runtime/lua/vim/lsp/inlay_hint.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp/inlay_hint.lua b/runtime/lua/vim/lsp/inlay_hint.lua index 2c81a3f465..c6be54e65f 100644 --- 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) -- cgit