Skip to content

Ability to insert JSDoc comment around plain text #21

@vincerubinetti

Description

@vincerubinetti

First off, thanks for this extension. I really need something like this after this very frustrating discussion on VSCode. Before this extension, I was using this much less ideal keyboard shortcut to insert JSDoc snippets:

{
  "key": "shift+alt+/",
  "command": "editor.action.insertSnippet",
  "args": {
    "snippet": "/** ${TM_SELECTED_TEXT/\\s*\\/\\/\\s*//}$1 */"
  }
}

It'd be nice to be able to create a JSDoc comment from a plain text string, as you can with the built-in VSCode comment toggler.

See the following demonstration. Starting from some plain text, I press cmd + / to use the built-in toggler to turn it into a regular JS comment. Then I undo that, and try to use the extension to do the same with a JSDoc comment, and it doesn't work in the same way. Then finally I do the built-in toggler first, then the extension, and it works.

Image

It's not a huge deal, since we can just use the built-in toggler then the extension. But that does require a few extra keystrokes, which adds up over time. It would allow users to first type or paste some ideas as plain text, then turn it into a comment, instead of needing to remember create the comment first.

I guess in general, instead of focusing on toggling between regular and JSDoc comments, maybe this extension could pivot to focusing on doing exactly what the built-in toggler does except with JSDoc comments? At least, that's what I'm looking for... but I could see other people not wanting that and getting annoyed. But perhaps that would make it easier to program and make expectations more clear, i.e. the other issues I see about unexpected behavior.

In other words, this makes more sense to me

flowchart LR
	n1["some text"]
	n2["// some text"]
	n3["/** some text */"]
	n1 <-->|"built-in toggler"| n2
	n1 <-->|"jsdoc toggler"| n3
Loading

than this

flowchart LR
	n1["some text"]
	n2["// some text"]
	n3["/** some text */"]
	n1 <-->|"built-in toggler"| n2
	n2 <-->|"jsdoc toggler"| n3
Loading

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions