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

Code action to convert single line to multiline comment #337

Open
tgodzik opened this issue Apr 5, 2023 · 2 comments
Open

Code action to convert single line to multiline comment #337

tgodzik opened this issue Apr 5, 2023 · 2 comments

Comments

@tgodzik
Copy link
Contributor

tgodzik commented Apr 5, 2023

Is your feature request related to a problem? Please describe.

Whenever you want to spread your comment over multiple line, you need to manually add /**/ which can be a bit of a hassle.

Also you might want to join multiple single line comments together

Describe the solution you'd like

The easiest would probably be a new code action that would show up on all single line tokens. Alternatively, we could use on type formatting when using newline in the middle of a comment.

Describe alternatives you've considered

Doing it manually.

Additional context

No response

Search terms

comment multiline single line

@ghostbuster91
Copy link

I can volunteer for this

@tgodzik
Copy link
Contributor Author

tgodzik commented Aug 25, 2023

Sure! You can take a look at MillifyScalaCliDependencyCodeAction to see a similar problem. You need the following steps:

  • run tokenizer on the code (or just the current line)
  • check if we are inside a comment
  • check if it's a single line comment
  • create a code action with an edit that changes the entire comment

Let me know if you have any issues!

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

No branches or pull requests

2 participants