cursive-ide / cursive

Cursive: The IDE for beautiful Clojure code
581 stars 7 forks source link

Request: config to use two semicolons ;; for line comments #1983

Closed eggsyntax closed 6 years ago

eggsyntax commented 6 years ago

Since Emacs (and I believe some other editors) heavily indent single-semicolon line comments, and since the Clojure style guide advocates using two semicolons for line comments, using a single semicolon for line comments leads to inconsistency and conflict on multiple-editor teams. My team ends up with a lot of whitespace noise in commits, as Cursive indents single-semicolon line comments one way, and then Emacs reindents them a different way, and then Cursive reindents them again... It would be really nice if there were a config option to cause Comment line (and any other parts of Cursive that create line comments) to use the double semicolon.

bbatsov commented 6 years ago

FWIW - in Emacs if you're in the beginning of a line we'd insert a ;;, if you're somewhere else - it'd be ;. Seems like a reasonable default behaviour to me that ideally should be shared across all tools.

Here's a bit of "historical" context - https://www.gnu.org/software/emacs/manual/html_node/elisp/Comment-Tips.html (it's pretty much the same for every major Lisp dialect)

cursive-ide commented 6 years ago

This is fixed for the next EAP build, controlled by config at Editor->General->Smart Keys->Clojure->Use ;; for line comments.

eggsyntax commented 6 years ago

Thank you, Colin, you are a scholar and a gentleman!

bbatsov commented 6 years ago

Indeed! Thanks, Colin!

vemv commented 6 years ago

Quick question (not a Cursive user myself) - with this improvement, can users hit ; just once and see ;; inserted?

A colleague of mine uses that keystroke-saving as an argument to prefer ; over ;;, so it'd be handy if Cursive made it easy.

(My understanding is that this ticket is concerned with comment toggling, but not necessarily with how a ; keystroke is handled)

cursive-ide commented 6 years ago

This works by adjusting the "Comment with Line Comment" action, which will comment the current line or selected lines, unless they're all commented in which case it will uncomment them. That's the standard way by which line comments are added in IntelliJ.

If the user just types ;, there's no magic there for that - if they want two, they'll have to press ; twice. Inside a line, you'd usually use the ; key but you only ever want a single semicolon there anyway.

arichiardi commented 6 years ago

Also have a question on behalf of a colleague on this.

We enabled the option but every time we comment, either with ; or ;;, the text gets aligned at the very right, with spaces in between. This seems to be a vanilla feature because he's just installed Cursive...

How can we choose our own alignment of the comment?

cursive-ide commented 6 years ago

@arichiardi Are you using the ; key to do this, or the Code->Comment with Line Comment action?

arichiardi commented 6 years ago

The ; directly

introom commented 4 years ago

is it possbile to add a space after the double colon, e.g., ;; foobar instead of ;;foobar