Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

/* */ comment on a single line inside braces keeps trying to un-indent #4009

Closed
jbt opened this issue Oct 30, 2014 · 6 comments
Closed

/* */ comment on a single line inside braces keeps trying to un-indent #4009

jbt opened this issue Oct 30, 2014 · 6 comments
Assignees
Labels

Comments

@jbt
Copy link

jbt commented Oct 30, 2014

If I have a /* comment */ on a single line, Atom automatically un-indents the line immediately when I type the closing */ and after various edits elsewhere on the line.

outdent-bug

(the re-indentation in that gif is me hitting ctrl+] to fix it)

It only seems to occur if the comment is inside some manner of braces or parentheses, for example:

  • /* foo */ (comment only thing on the line) perfectly fine
  • foo /* bar */ also fine
  • if( /* foo */ is fine but as soon as I type the closing ) it outdents (and then again for subsequent additions to the line), or if the ) was already there thanks to auto-insertion of closing brackets

I think this may be specific to JavaScript syntax, so apologies if the issue should be on language-javascript instead.

Happens in atom built straight off master, but has been happening for a while now, definitely at least since 0.120 or so. Also happens with --safe so it isn't a package issue.

@lee-dohm
Copy link
Contributor

Can you reproduce this issue in another C-like language syntax? Like Java or C?

@jbt
Copy link
Author

jbt commented Oct 30, 2014

Nope, doesn't look like it. It does appear to be JS-specific

@thomasjo
Copy link
Contributor

I've successfully reproduced this by doing exactly what @jbt is doing in the provided GIF. Trying to debug.

@thomasjo
Copy link
Contributor

Reproduced this with C as well;

void main() {
  if (TRUE) { /* I cause issues... */}
}

As soon as the comment is closed, the line loses one level of indentation. Wondering if this is an issue with bracket-matcher? If I insert a newline after { and before } (in both JS and C), the comment does not affect the indentation.

@kevinsawicki kevinsawicki self-assigned this Oct 31, 2014
kevinsawicki added a commit to atom/language-javascript that referenced this issue Oct 31, 2014
@kevinsawicki
Copy link
Contributor

Thanks for reporting this @jbt and thanks @thomasjo for reporting it broken in C as well.

I've fixed it in both the language-c and language-javascript packages and the updated versions will be in the next Atom release, 0.142

drewctaylor pushed a commit to drewctaylor/multiverse-syntax that referenced this issue May 10, 2015
@lock
Copy link

lock bot commented Jan 25, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

@lock lock bot locked as resolved and limited conversation to collaborators Jan 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants