Auto-insert `//` for additional non-dartdoc comment lines
See original GitHub issuehttps://github.com/Dart-Code/Dart-Code/issues/147 requested automatically inserting ///
when pressing Enter on a dartdoc comment line, but could we do the same for non-dartdoc comment lines? IMO we should just preserve whatever the current comment marker is.
I vaguely recall seeing some discussion about this before, but if it happened, I seem unable to find it now. Is it intentionally not done because there’s some expectation that users might be annoyed if they write a comment, hit Enter, and then expect to write code? If that’s a concern, is it possible to have an option, or maybe make, say, Enter/Shift+Enter do different things?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Add an Option for "Auto-insert `//` for additional non-dartdoc ...
In contrast, with // , I'm usually writing a single-line comment or I've just commented out a block of code. In either case,...
Read more >Effective Dart: Documentation
We all know code should be self-documenting and not all comments are helpful. ... Add a blank line after the first sentence to...
Read more >Dart on VsCode: How to enable comment continuation on ...
I checked this question about the same feature for Rust language: How to configure VSCode to auto insert comment chars on multi line...
Read more >dartdoc | Dart Package - Pub.dev
A non-interactive HTML documentation generator for Dart source code.
Read more >Dartdoc comment style - Google Groups
The reason I ask is that my text editor does not handle '///' comments correctly ... adding an command line option to dartfmt...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, I like that - and I think it’s reasonable to have it enabled always (as long as you haven’t set the setting to
none
).I’ve added this line to the end of the setting because I also couldn’t come up with a better way, but I’m open to changing it before it ships if someone has a better idea. Thanks!
So with the default (
tripleSlash
), it won’t add//
to the end of a comment, but it will when there is text after the caret. It’ll try to do the right thing with spaces too - so if you press<enter>
with a space after the caret it will avoid inserting an additional one after the slashes.That’s fair. I’m a bit on the fence - the new behaviour surprised me a few times (because I’m used to it not happening), but a few times was helpful to.
Please do file a new issue, and I’ll add a setting. Thanks!