kkoomen / vim-doge

(Do)cumentation (Ge)nerator for nearly 20 languages 📚 Generate proper code documentation with a single keypress. ⚡️🔥
GNU General Public License v3.0
1.01k stars 51 forks source link

cpp parser failed #644

Closed NeumoNeumo closed 12 months ago

NeumoNeumo commented 1 year ago

Describe the bug

With a minimal setting of packer and vim-doge, and a cpp file with simple function. :DogeGenerate throws an error "cpp parser failed"

image

Settings

I did not configure vim-doge specifically. My only config is using packer to install vim-doge like this

local ensure_packer = function()
  local fn = vim.fn
  local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
  if fn.empty(fn.glob(install_path)) > 0 then
    fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
    vim.cmd [[packadd packer.nvim]]
    return true
  end
  return false
end

local packer_bootstrap = ensure_packer()

vim.cmd([[
    augroup packer_user_config
        autocmd!
        autocmd BufWritePost plugins-install.lua source <afile> | PackerSync
    augroup end
]])

return require('packer').startup(function(use)
  use 'wbthomason/packer.nvim'
  -- My plugins here

  -- DOcumentation GEnerator
  use { 'kkoomen/vim-doge', run = ':call doge#install()' }

  -- Automatically set up your configuration after cloning packer.nvim
  -- Put this at the end after all plugins
  if packer_bootstrap then
    require('packer').sync()
  end
end)

To Reproduce

Steps to reproduce the behavior:

  1. Use the config file above to install packer and vim-doge
  2. Create a cpp file a.cpp with very simple codes
    int add(int a, int b){
        return a+b;
    }
  3. nvim a.cpp to edit this file
  4. run command :DogeGenerate and you'll get the error.

Expected behavior

I hope vim-doge helps me generate a cpp docstring.

Screenshots

image

Output of ./bin/vim-doge-helper --version

vim-doge-helper 4.6.0

Output of vim --version

NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info

Output of node --version

v18.16.1

I am using fish shell with nvm to control node versions. Every time a fish shell is started, nvm is called to activate the node environment. That's why you'll see the following line

Now using Node v18.16.1 (npm 9.5.1) ~/.local/share/nvm/v18.16.1/bin/node
kkoomen commented 12 months ago

Hi,

This doesn't look like this is a problem with vim-doge, but rather your local environment since tests do pass for the latest stable NVIM 0.9.4.

What if you temporary disable the call to nvm when a new shell is opened such that it doesn't echo anything when opening a new shell. Does that fix it?

NeumoNeumo commented 12 months ago

Yes, you are right! It is nvm that should be blamed for this issue.