diff options
author | Yi Ming <ofseed@foxmail.com> | 2024-05-03 22:18:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-03 07:18:55 -0700 |
commit | 52823616bc4d77898ddc03da7629280841d3bced (patch) | |
tree | 7d250e9974de67894071e0107777dca6e9c19d04 /runtime/lua/vim/lsp/inlay_hint.lua | |
parent | ca243f06dd055adff3749a89fce489524eb59ab8 (diff) | |
download | rneovim-52823616bc4d77898ddc03da7629280841d3bced.tar.gz rneovim-52823616bc4d77898ddc03da7629280841d3bced.tar.bz2 rneovim-52823616bc4d77898ddc03da7629280841d3bced.zip |
fix(lsp): replace bug-prone ternary operation #28627
ref #28624
Diffstat (limited to 'runtime/lua/vim/lsp/inlay_hint.lua')
-rw-r--r-- | runtime/lua/vim/lsp/inlay_hint.lua | 6 |
1 files changed, 5 insertions, 1 deletions
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) |