From e5fff9a169ac3912ad8ed5096bba83f2c64c2fea Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Sun, 14 Apr 2024 16:02:15 +0200 Subject: [PATCH] feat(treesitter): add comment syntax highlighting --- lua/plugins/treesitter.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 9c585b0..cf6827f 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -15,6 +15,7 @@ local function setup() "markdown", -- for noice "markdown_inline", -- for noice "org", + "comment", }, auto_install = true, @@ -33,6 +34,14 @@ local function setup() vim.opt.foldmethod = "expr" vim.opt.foldexpr = "nvim_treesitter#foldexpr()" vim.opt.foldenable = true + + -- Disable LSP semantic highlighting for comments because it will otherwise + -- override highlights from `comment`. + vim.api.nvim_set_hl(0, '@lsp.type.comment', {}) + + -- To set the priority of semantic highlighting lower than treesitter (100), + -- uncomment the line below: + -- vim.highlight.priorities.semantic_tokens = 99 end return setup