diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lvim/core/comment.lua | 44 | ||||
| -rw-r--r-- | lua/lvim/lsp/config.lua | 6 | 
2 files changed, 24 insertions, 26 deletions
| diff --git a/lua/lvim/core/comment.lua b/lua/lvim/core/comment.lua index d07739c6..501d01b6 100644 --- a/lua/lvim/core/comment.lua +++ b/lua/lvim/core/comment.lua @@ -1,27 +1,10 @@  local M = {}  function M.config() -  local pre_hook = nil -  if lvim.builtin.treesitter.context_commentstring.enable then -    pre_hook = function(ctx) -      local U = require "Comment.utils" - -      -- Determine whether to use linewise or blockwise commentstring -      local type = ctx.ctype == U.ctype.linewise and "__default" or "__multiline" - -      -- Determine the location where to calculate commentstring from -      local location = nil -      if ctx.ctype == U.ctype.blockwise then -        location = require("ts_context_commentstring.utils").get_cursor_location() -      elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then -        location = require("ts_context_commentstring.utils").get_visual_start_location() -      end - -      return require("ts_context_commentstring.internal").calculate_commentstring { -        key = type, -        location = location, -      } -    end +  local pre_hook +  local loaded, ts_comment = pcall(require, "ts_context_commentstring.integrations.comment_nvim") +  if loaded and ts_comment then +    pre_hook = ts_comment.create_pre_hook()    end    lvim.builtin.comment = {      active = true, @@ -30,6 +13,11 @@ function M.config()      ---@type boolean      padding = true, +    ---Whether cursor should stay at the +    ---same position. Only works in NORMAL +    ---mode mappings +    sticky = true, +      ---Lines to be ignored while comment/uncomment.      ---Could be a regex string or a function that returns a regex string.      ---Example: Use '^$' to ignore empty lines @@ -45,9 +33,6 @@ function M.config()        ---Extra mapping        ---Includes `gco`, `gcO`, `gcA`        extra = true, -      ---Extended mapping -      ---Includes `g>`, `g<`, `g>[count]{motion}` and `g<[count]{motion}` -      extended = false,      },      ---LHS of line and block comment toggle mapping in NORMAL/VISUAL mode @@ -68,6 +53,17 @@ function M.config()        block = "gb",      }, +    ---LHS of extra mappings +    ---@type table +    extra = { +      ---Add comment on the line above +      above = "gcO", +      ---Add comment on the line below +      below = "gco", +      ---Add comment at the end of line +      eol = "gcA", +    }, +      ---Pre-hook, called before commenting the line      ---@type function|nil      pre_hook = pre_hook, diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index b1a45d5e..358e83f8 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -10,6 +10,7 @@ local skipped_servers = {    "eslint",    "eslintls",    "golangci_lint_ls", +  "gradle_ls",    "graphql",    "jedi_language_server",    "ltex", @@ -18,8 +19,9 @@ local skipped_servers = {    "psalm",    "pylsp",    "quick_lint_js", -  "rome",    "reason_ls", +  "rome", +  "ruby_ls",    "scry",    "solang",    "solc", @@ -31,8 +33,8 @@ local skipped_servers = {    "sqlls",    "sqls",    "stylelint_lsp", -  "tflint",    "svlangserver", +  "tflint",    "verible",    "vuels",  } | 
