From a092c0df013aa88e982d8bf2f6582caae2fa1dc9 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sat, 18 Nov 2023 17:36:41 -0600 Subject: [PATCH] refactor(nvim): use newer method of setting up ts-context-commentstring Had a deprecation on old usage as ts module --- .../nvim/lua/plugins/configs/comment.lua | 23 ++++++++++++++++--- .../nvim/lua/plugins/configs/treesitter.lua | 13 ++++------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/dots/.config/nvim/lua/plugins/configs/comment.lua b/dots/.config/nvim/lua/plugins/configs/comment.lua index 7fb7acb6..fc674954 100644 --- a/dots/.config/nvim/lua/plugins/configs/comment.lua +++ b/dots/.config/nvim/lua/plugins/configs/comment.lua @@ -1,10 +1,27 @@ return { { "numToStr/Comment.nvim", - config = true, + config = function() + require("Comment").setup({ + pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(), + }) + end, + dependencies = { + { + "JoosepAlviste/nvim-ts-context-commentstring", + opts = function() + vim.g.skip_ts_context_commentstring_module = true + end, + config = function() + require('ts_context_commentstring').setup({ + enable_autocmd = false + }) + end + }, + }, keys = { - { "gc", desc = "> Comment: Line" }, - { "gb", desc = "> Comment: Block " }, + { "gc", desc = "> Comment: Line" }, + { "gb", desc = "> Comment: Block " }, { "gbc", desc = "Comment: Toggle block comment" }, { "gcc", desc = "Comment: Toggle line comment" }, { "gcO", desc = "Comment: Add comment on line above" }, diff --git a/dots/.config/nvim/lua/plugins/configs/treesitter.lua b/dots/.config/nvim/lua/plugins/configs/treesitter.lua index 70040e8f..05645c7f 100644 --- a/dots/.config/nvim/lua/plugins/configs/treesitter.lua +++ b/dots/.config/nvim/lua/plugins/configs/treesitter.lua @@ -3,11 +3,11 @@ return { { "danymat/neogen", keys = { - { "ng", desc = "> Neogen" }, - { "ngf", "Neogen func", desc = "Neogen: Function Annotation" }, + { "ng", desc = "> Neogen" }, + { "ngf", "Neogen func", desc = "Neogen: Function Annotation" }, { "ngc", "Neogen class", desc = "Neogen: Class Annotation" }, - { "ngt", "Neogen type", desc = "Neogen: Type Annotation" }, - { "ngb", "Neogen file", desc = "Neogen: File Annotation" }, + { "ngt", "Neogen type", desc = "Neogen: Type Annotation" }, + { "ngb", "Neogen file", desc = "Neogen: File Annotation" }, }, cmd = { "Neogen", @@ -122,13 +122,11 @@ return { "pfeiferj/nvim-hurl", config = true, }, - "JoosepAlviste/nvim-ts-context-commentstring", "nvim-treesitter/nvim-treesitter-textobjects", "RRethy/nvim-treesitter-endwise", }, config = function() require("nvim-treesitter.configs").setup({ - parser_install_dir = treesitter_dir, auto_install = true, ignore_install = { "comment" }, incremental_selection = { @@ -176,9 +174,6 @@ return { query_linter = { enable = true, }, - context_commentstring = { - enable = true, - }, endwise = { enable = true, },