Skip to content

wrong string for comment #230

Description

@lalitmee

I am not sure what is changed in Comment.nvim but somehow when I press gcc in a lua file for a line it does this

  • Actual Behaviour
--[[ use({ "lewis6991/impatient.nvim" }) ]]
  • Expected Behavior
-- use({ "lewis6991/impatient.nvim" })

I have noticed that its happening for almost all the file types in which multiline comments exist. For example: javascript, lua, etc.

  • My config:
local status_ok, comment = lk.require("Comment")
if not status_ok then
  return
end

comment.setup({
  -- opleader = {
  --   line = "gc",
  --   block = "gb",
  -- },
  -- ignore = "^$",
  pre_hook = function(ctx)
    local U = require("Comment.utils")

    local location = nil
    if ctx.ctype == U.ctype.block 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 = ctx.ctype == U.ctype.line and "__default" or "__multiline",
      location = location,
    })
  end,
})
  • nvim --version
NVIM v0.8.0-dev-1008-g12fe197cf
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -I/home/linuxbrew/.linuxbrew/opt/openssl@3/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/lalitmee/Desktop/Github/neovim/build/cmake.config -I/home/lalitmee/Desktop/Github/neovim/src -I/home/lalitmee/Desktop/Github/neovim/.deps/usr/include -I/usr/include -I/home/lalitmee/Desktop/Github/neovim/build/src/nvim/auto -I/home/lalitmee/Desktop/Github/neovim/build/include
Compiled by lalitmee@pop-os

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

NOTE: I haven't setup any commentstring for any file type.

Please help me with this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions