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

[JSDoc] Specific defult parameter prevents @params from being generated #651

Closed zyriab closed 10 months ago

zyriab commented 10 months ago

Describe the bug When generating JSDoc comments on a function that has the following default parameter import.meta.url (or any at least with 2 dots and 3 words) the comment generation is not working as intended (see screenshot).

I have tried with the default config as asked in this bug report template.

Settings Default settings

To Reproduce

  1. Write a function with a default parameter that calls the nested properties of an object, with a depth of at least 2, such as foo = bar.baz.qux
  2. Call DogeGenerate
  3. You should have
    /**
    * [TODO:description]
    *
    * @function import#url
    */
    function foo(bar = import.meta.url) {
    return true;
    }

Expected behavior It should generate the following

/**
 * [TODO:description]
 *
 * @param {[TODO:type]} [bar] - [TODO:description]
 * @returns {[TODO:type]} [TODO:description]
 */
function foo(bar = import.meta.url) {
    return true;
}

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

Output of vim --version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1703358377

Environment MacBook Pro 2018 15-inch (2.2Ghz 6-core i7 w/ 16GB RAM) OS: MacOS Sonoma 14.2.1 Editor: Neovim 0.9.5 Package manager: Lazy.nvim

kkoomen commented 10 months ago

Hi! This is clearly a bug for a very rare case. In te past 10 years of doing JS/TS development I've rarely done this. Good catch. I'll fix it immediately.

kkoomen commented 10 months ago

This bug has been fixed and released in v4.6.2.

Feel free to submit any new issues if you experience any unwanted behavior in the future. Thanks for your contribution.

zyriab commented 10 months ago

You rule, @kkoomen!