zed icon indicating copy to clipboard operation
zed copied to clipboard

Better support for C style multiline comments

Open jansol opened this issue 1 year ago • 2 comments

Check for existing issues

  • [X] Completed

Describe the feature

The "toggle comment" action prepends the line command marker to the current/selected line(s). However in C files, it uses the C++-style line comment marker //, which is not available before C99 and disallowed by policy in several environments (such as those following MISRA-C-2004)

It would be nice if zed would use the C style comment block syntax in C files instead: /* */.

  • [ ] Block comment blocks may not be nested
  • [ ] Block comments may span multiple lines
  • [x] An option for prefixing each line within a multi-line comment automatically with * (note the space to align with the * of the initial /*) would be nice (not required but it is a common convention to denote that a line is part of an ongoing comment without having to scan through to the end of the line)
    • [x] (including for newlines typed while editing such a comment)

If applicable, add mockups / screenshots to help present your vision of the feature

No response

jansol avatar Jun 20 '24 16:06 jansol

VSCode has dedicated shortcuts for multiline comment in addition to cmd+/ or ctrl+/

Windows: shift+alt+A Linux: shift+ctrl+A MacOS: shift+option+A

notpeter avatar Jul 16 '24 02:07 notpeter

Users of other languages have request similar features:

  • php: https://github.com/zed-industries/zed/issues/17261
  • golang: https://github.com/zed-industries/zed/issues/14485#issuecomment-2229642428

See also:

  • https://github.com/zed-industries/zed/issues/4751

notpeter avatar Sep 02 '24 18:09 notpeter