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

Invalid @param generated for C functions that use void #321

Closed
shyun3 opened this issue Dec 13, 2021 · 2 comments
Closed

Invalid @param generated for C functions that use void #321

shyun3 opened this issue Dec 13, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@shyun3
Copy link

shyun3 commented Dec 13, 2021

Describe the bug

When using doge on a C void function, a @param is generated when it shouldn't be since void corresponds to no parameters/arguments.

Settings

let g:doge_doc_standard_python = 'google'
let g:doge_comment_jump_modes = ['n', 's']

To Reproduce

  • Create file doge.vim with:
set nocompatible
set runtimepath^=/path/to/vim-doge
filetype plugin indent on
syntax on
set hidden
  • Start (neo)vim with command: vim -u doge.vim

Steps to reproduce the behavior:

  1. Create test.c as follows: echo "void bar(void);" > test.c
  2. Open file with (Neo)vim: nvim -u doge.vim test.c
  3. Place cursor on the bar function prototype and hit <leader>d.
  4. The following should be the result:
    /**
     * @brief [TODO:description]
     *
     * @param {name} [TODO:description]
     */
    void bar(void);
    Note the line with @param. This should not be present since the function effectively has no parameters.

Expected behavior

The following should have been the result of the previous steps:

/**
 * @brief [TODO:description]
 */
void bar(void);

Screenshots

None, the previous explanations should be sufficient.

Output of vim --version

NVIM v0.6.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -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/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az65-618

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

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

Run :checkhealth for more info
@shyun3 shyun3 added the bug Something isn't working label Dec 13, 2021
@kkoomen
Copy link
Owner

kkoomen commented Dec 21, 2021

Why should vim-doge handle this? This seems a user-related issue. Unless void is mandatory in C when no parameters are expected, just omit the void.

@shyun3
Copy link
Author

shyun3 commented Dec 22, 2021

Yes, void is mandatory in C if the function takes no arguments.

shyun3 added a commit to shyun3/nvimrc that referenced this issue Jan 22, 2022
DoGe does not handle C `void` functions properly.

See kkoomen/vim-doge#321.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants