aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/semantic_tokens.lua
diff options
context:
space:
mode:
authorjdrouhard <john@drouhard.dev>2022-12-30 09:40:23 -0600
committerGitHub <noreply@github.com>2022-12-30 16:40:23 +0100
commit469f9859238fa179448a31863e0f3894c9bc9c99 (patch)
tree109aabafbbe2e32309116eae36f2caccc9b223d0 /runtime/lua/vim/lsp/semantic_tokens.lua
parentcb9d68fe6daf214ba703b9c2376fc8a2b8ae7079 (diff)
downloadrneovim-469f9859238fa179448a31863e0f3894c9bc9c99.tar.gz
rneovim-469f9859238fa179448a31863e0f3894c9bc9c99.tar.bz2
rneovim-469f9859238fa179448a31863e0f3894c9bc9c99.zip
fix(lsp): adjust gravity of semantic tokens extmarks (#21574)
Fixes #21543 This should provide a better user experience when appending or prepending text to a word that has a semantic token extmark. More often than not, the appended/prepended text to the word will end up becoming part of the token anyway, so just use that extmark as the user types.
Diffstat (limited to 'runtime/lua/vim/lsp/semantic_tokens.lua')
-rw-r--r--runtime/lua/vim/lsp/semantic_tokens.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/semantic_tokens.lua b/runtime/lua/vim/lsp/semantic_tokens.lua
index 48190b03e1..849a8a1b67 100644
--- a/runtime/lua/vim/lsp/semantic_tokens.lua
+++ b/runtime/lua/vim/lsp/semantic_tokens.lua
@@ -408,6 +408,8 @@ function STHighlighter:on_win(topline, botline)
hl_group = '@' .. token.type,
end_col = token.end_col,
priority = vim.highlight.priorities.semantic_tokens,
+ right_gravity = false,
+ end_right_gravity = true,
strict = false,
})
@@ -417,7 +419,9 @@ function STHighlighter:on_win(topline, botline)
api.nvim_buf_set_extmark(self.bufnr, state.namespace, token.line, token.start_col, {
hl_group = '@' .. modifier,
end_col = token.end_col,
- priority = vim.highlight.priorities.semantic_tokens,
+ priority = vim.highlight.priorities.semantic_tokens + 1,
+ right_gravity = false,
+ end_right_gravity = true,
strict = false,
})
end