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

Support for updating existing JSDoc comments? #121

Open
zeitchef opened this issue Dec 29, 2021 · 12 comments
Open

Support for updating existing JSDoc comments? #121

zeitchef opened this issue Dec 29, 2021 · 12 comments

Comments

@zeitchef
Copy link

Just found this plugin and enjoying using it. Something I'm testing is that existing JSDoc comments are not changed/updated when a function signature changes. Is this intentional? Or have I overseen something in the usage?

@heavenshell
Copy link
Owner

@zeitchef Thank you for comment.
Yes, intentional. Currently it's by design.
Should we provide something like override option?
(Delete current JSDoc and re-generate JSDoc automatically)

@zeitchef
Copy link
Author

@heavenshell Thanks for your quick response. It seems much more intuitive to me that comments are updated automatically when the function signature changes. I would go so far as to say this should perhaps be default behavior, but I would be just as happy with a config option to override existing comments.

@heavenshell
Copy link
Owner

Thank you for comment!

comments are updated automatically when the function signature changes.

Yeah, I know update automatically is very useful, but it's hard to merge old and new.
For example.

/**
 * Edit this line by manually
 *
 * @param {number} arg1
 * @param {string} edit this line manually
 * @param {any} same2
 */
function foo(arg1: number, before1: string, same2: any) {
}
/**
 * foo. <-- Preserve or update?
 *
 * @param {number} arg1
 * @param {string} after1 <-- Preserve this or update?
 * @param {any} same2
 */
function foo(arg1: number, after1: string, same2: any) {
}

I think I will provide override option.
(I should update ast parser library)
I'll I add this update to my TODO list.
However I'm bit busy now(till end of Feb).
So, please stay tuned 🙏

@ryuheechul
Copy link

ryuheechul commented Sep 14, 2022

Yeah I think override sounds good as undo will allow people to go back if overriding is not what they wanted.

A trick (as a user) I found is that move existing comments not right above the function (say add a new line between comment and function) and run :JsDoc and mix and match with old and new.

@heavenshell
Copy link
Owner

@ryuheechul Thanks for comment.
I'm very busy in my primary job.
So, please stay tuned.

A trick (as a user) I found is that move existing comments not right above the function (say add a new line between comment and function) and run :JsDoc and mix and match with old and new.

Yeah, you can do it by your self(by manual editing or writing Vim script), but I'll add override option.

@alejandroscotti
Copy link

Hello! has this override feature been released? :-)

@heavenshell
Copy link
Owner

Sorry for late response and not yet.
I've been busy with my day job and haven't made progress 😰

@ryuheechul
Copy link

FYI, Neogen is also having the same issue and the logic to tackle the issue seems to be tricky. Perhaps AI approach like this one, https://github.com/jameshiew/nvim-magic could be an alternative in the meantime.

@heavenshell
Copy link
Owner

@ryuheechul
Thanks.
Yeah as I mentioned before, this is very difficult.

Most easiest implementation is override previous comment completely.
If user changed/added comment manually, that comment will be gone.

If user want to keep previous comment, maybe we should ask user to keep or override by each line(like interactive patching).
But this is hard...

So maybe I'll implement override previous comment completely for first release.

@ryuheechul
Copy link

@heavenshell Yeah I have the similar view as yours.
About the first release of such, (just in case) maybe overriding previous comment completely shouldn't be a default behaviour though (to prevent a surprise). If that feature is only enabled via intentionally turning it on, that would be great. What do you think?

@heavenshell
Copy link
Owner

@ryuheechul
Yeah, I don't like BCBreak.

Mabye I will introduce :JsDoc! command.
:JsDoc -> current behavior
:JsDoc! -> override previous jsdoc

@ryuheechul
Copy link

@heavenshell that seems intuitive!

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

4 participants