commit 469f9859238fa179448a31863e0f3894c9bc9c99
parent cb9d68fe6daf214ba703b9c2376fc8a2b8ae7079
Author: jdrouhard <john@drouhard.dev>
Date: Fri, 30 Dec 2022 09:40:23 -0600
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:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git 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