Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error While Generating File Documents #196

Open
ancientjpeg opened this issue Aug 20, 2024 · 1 comment
Open

Error While Generating File Documents #196

ancientjpeg opened this issue Aug 20, 2024 · 1 comment

Comments

@ancientjpeg
Copy link

I've been encountering this error when I attempt to generate a file comment:

E5108: Error executing lua ...ialnsa/.local/share/nvim/lazy/neogen/lua/neogen/mark.lua:72: Invalid 'end_co
l': out of range
stack traceback:
        [C]: in function 'nvim_buf_set_extmark'
        ...ialnsa/.local/share/nvim/lazy/neogen/lua/neogen/mark.lua:72: in function 'add_range_mark'
        ...a/.local/share/nvim/lazy/neogen/lua/neogen/generator.lua:351: in function 'generate'
        [string ":lua"]:1: in main chunk

I'm not 100% sure but it seems to only happen when the file is empty.

Here's my full setup for the plugin using lazy.nvim (slightly redacted for privacy):

return {
  "danymat/neogen",
  config = function()
    local i             = require("neogen.types.template").item
    local doxygen_setup = {
      { nil,         "/**",                                               { no_results = true, type = { "func", "file", "class" } } },
      { nil,         " * @file $1",                                       { no_results = true, type = { "file" } } },
      { nil,         " * @author AUTHOR_NAME", { no_results = true, type = { "file" } } },
      { nil,         " * @date " .. os.date("%Y-%m-%d"),                  { no_results = true, type = { "file" } } },
      { nil,         " * Copyright © 2024 COMPANY_NAME. All rights reserved.", { no_results = true, type = { "file" } } },
      { nil,         " */",                                               { no_results = true, type = { "func", "file", "class" } } },
      { nil,         "",                                                  { no_results = true, type = { "file" } } },

      { nil,         "/**",                                               { type = { "func", "class", "type" } } },
      { i.ClassName, " * @class %s",                                      { type = { "class" } } },
      { i.Type,      " * @typedef %s",                                    { type = { "type" } } },
      { nil,         " * @brief $1",                                      { type = { "func", "class", "type" } } },
      { nil,         " *",                                                { type = { "func", "class", "type" } } },
      { i.Tparam,    " * @tparam %s $1" },
      { i.Parameter, " * @param %s $1" },
      { i.Return,    " * @return $1" },
      { nil,         " */",                                               { type = { "func", "class", "type" } } },
    }

    require('neogen').setup({
      languages = {
        cpp = {
          template = {
            annotation_convention = "custom_doxygen",
            custom_doxygen = doxygen_setup
          }
        }
      }
    })
  end,
  keys   = {
    { "<leader>nf", "<cmd>Neogen<cr>",      desc = "Neogen Generate" },
    { "<leader>nF", "<cmd>Neogen file<cr>", desc = "Neogen Generate File Docstring" },
  },
}
@Xiao001010
Copy link

Xiao001010 commented Oct 5, 2024

I solved this by installing lang.clangd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants