You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Sometimes, when copy/pasting some code around with comments, I notice that part of my code becomes improperly marked as comments. You can see it happened here, and it becomes normal again when you play around with the comment above it:
Unfortunately, I have not yet found out how it can consistently be reproduced, but I've seen it happen at least 5-6 times already.
I suspect though that it has to do with comment blocks starting with /*. As you can see in the screen recording, the marking seems to end at the */ in the path definition, so it looks as if it's thinking the code above it is part of a comment block still.
Well, as I said, I haven't found a way to reproduce it yet consistently, but once it happens again I will try to analyze what I did and see if I can reproduce it.
@mnquintana I have found a way to reproduce it consistently, see attached screencast:
It appears to happen when a doc block comment is started and then completed via code completion.
When you enter the first few characters (/*), the trailing code is marked as a comment, because there's no comment ending found (*/).
However, once the code completion is triggered and the comment ending is inserted, the rest of the code remains flagged as a comment and does not get updated.
@benogle this issue also has consistent reproduction steps now, can you remove the needs reproduction label? Unless you need more information, I'm happy to help. Still happens to me occasionally.
Thanks. I'm pretty sure it also happened to me in SCSS files once or twice, so not sure which package is responsible. It's not like the language detects it wrong, I think it's that the language detects it a split second before the comment is completed by the auto completer, and then never updates it afterwards.
I can't reproduce this using the provided snippet on Java, JS, or C files. Please tell me if I'm doing something wrong (provided GIF is using language-c).
I was using a development version of the package, as I had made some changes to it. Removed this now, and on 0.105.0 now (version bundled with 1.5.0 atom I suppose).
The issue is still reproducible though. Perhaps it only occurs on Mac due to some differences in keyboard input handling? Is there someone else on the dev team with a Mac that could check this behaviour?
Here's another demo of it happening inside a describe test block
I think the issue has to do with the fact that maybe the code highlighting isn't run again after the auto completed code is inserted, making the highlighter think that the comment was never closed, hence never un-marking the code from being a comment. Is that a possibility?
I did some investigating and managed to figure out when this happens I think, it has to do with whitespace/invisibles/indentation on all the lines. I did not manage to reproduce when copy/pasting as the original post stated but didn't test much with copy/pasting.
Example, if you expand this snippet in a js file it reproduces, this is with the default js snippet for block comments no custom snippets needed.
function a(b) {
/**
<NON INDENTED EMPTY LINE WITH ONLY A CRLF OR LF CHARACTER>
var c = b +15;
return c;
}
But not if you expand this:
function a(b) {
/**
<INDENTED EMPTY LINE>
var c = b +15;
return c;
}
And not if you expand this:
function a(b) {
/**
<NON INDENTED EMPTY LINE WITH ONLY A CRLF OR LF CHARACTER>
var c = b +15;
return c;
}
Also not if you expand this:
function a(b) {
/**
<NON INDENTED EMPTY LINE WITH ONLY A CRLF OR LF CHARACTER>
var c = b +15;
return c;
}
Also not if you expand this:
function a(b) {
/**
<NON INDENTED EMPTY LINE WITH ONLY A CRLF OR LF CHARACTER>
<TABBED LINE PAST THE SNIPPET LINE>
var c = b +15;
return c;
}
But it does if you expand this:
function a(b) {
/**
<NON INDENTED EMPTY LINE WITH ONLY A CRLF OR LF CHARACTER>
<NON INDENTED EMPTY LINE WITH ONLY A CRLF OR LF CHARACTER>
<TABBED LINE NOT PAST THE SNIPPET LINE>
<TABBED LINE NOT PAST THE SNIPPET LINE>
var c = b +15;
return c;
}
I am on Windows 7 with Atom 1.8.0, I can maybe test the latest master later but I don't have it built now because I am on the node4 npm3 branch.
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!
Activity
[-]Code sometimes improperly marked as comments[/-][+]Code sometimes improperly marked as comment[/+]mnquintana commentedon Jun 12, 2015
Would you mind moving this to https://github.com/atom/language-javascript?
adamreisnz commentedon Jun 12, 2015
I don't think it's only javascript related, I recall seeing it happen in CSS as well. Is that possible?
mnquintana commentedon Jun 12, 2015
Can you reproduce this in safe mode? (
atom --safe)adamreisnz commentedon Jun 12, 2015
Well, as I said, I haven't found a way to reproduce it yet consistently, but once it happens again I will try to analyze what I did and see if I can reproduce it.
adamreisnz commentedon Sep 25, 2015
@mnquintana I have found a way to reproduce it consistently, see attached screencast:
It appears to happen when a doc block comment is started and then completed via code completion.
When you enter the first few characters (
/*), the trailing code is marked as a comment, because there's no comment ending found (*/).However, once the code completion is triggered and the comment ending is inserted, the rest of the code remains flagged as a comment and does not get updated.
Hope this helps.
adamreisnz commentedon Feb 10, 2016
@benogle this issue also has consistent reproduction steps now, can you remove the needs reproduction label? Unless you need more information, I'm happy to help. Still happens to me occasionally.
benogle commentedon Feb 10, 2016
Sure. This seems like a
language-javascriptissue, no?adamreisnz commentedon Feb 10, 2016
Thanks. I'm pretty sure it also happened to me in SCSS files once or twice, so not sure which package is responsible. It's not like the language detects it wrong, I think it's that the language detects it a split second before the comment is completed by the auto completer, and then never updates it afterwards.
winstliu commentedon Feb 10, 2016
@adambuczynski How are you triggering autocompletion for the comment block?
adamreisnz commentedon Feb 10, 2016
This is my snippet for the code block:
And it's triggered by
/*+tabwinstliu commentedon Feb 10, 2016
I can't reproduce this using the provided snippet on Java, JS, or C files. Please tell me if I'm doing something wrong (provided GIF is using language-c).

apm list --installed --bare:Atom 1.6.0-dev-d091a10, Windows 10 x64.
adamreisnz commentedon Feb 10, 2016
@50Wliu can you try with the following code? This works consistently for me:
This will turn the line
return test;into a comment, after you tab complete the snippet.The following also works:
Behaviour:
This is with language-javascript, Atom 1.5.0 on OS X.
winstliu commentedon Feb 10, 2016
Still nothing. I noticed you're using [email protected] though, while the latest version is 0.110.0.
I would try to reproduce in safe mode but I don't think
snippets.csongets loaded in that scenario.adamreisnz commentedon Feb 10, 2016
I was using a development version of the package, as I had made some changes to it. Removed this now, and on 0.105.0 now (version bundled with 1.5.0 atom I suppose).
The issue is still reproducible though. Perhaps it only occurs on Mac due to some differences in keyboard input handling? Is there someone else on the dev team with a Mac that could check this behaviour?
liatreis commentedon Feb 10, 2016
Same issue for me on Windows 7, so not for Mac only.
adamreisnz commentedon Feb 16, 2016
Here's another demo of it happening inside a
describetest blockI think the issue has to do with the fact that maybe the code highlighting isn't run again after the auto completed code is inserted, making the highlighter think that the comment was never closed, hence never un-marking the code from being a comment. Is that a possibility?
adamreisnz commentedon Jun 6, 2016
In case anyone wants to reproduce, this is the snippet I use that's causing the issue:
Ben3eeE commentedon Jun 8, 2016
I did some investigating and managed to figure out when this happens I think, it has to do with whitespace/invisibles/indentation on all the lines. I did not manage to reproduce when copy/pasting as the original post stated but didn't test much with copy/pasting.
Example, if you expand this snippet in a js file it reproduces, this is with the default js snippet for block comments no custom snippets needed.
But not if you expand this:
And not if you expand this:
Also not if you expand this:
Also not if you expand this:
But it does if you expand this:
I am on Windows 7 with Atom 1.8.0, I can maybe test the latest master later but I don't have it built now because I am on the node4 npm3 branch.
adamreisnz commentedon Aug 21, 2017
I don't think this is happening anymore, so I'm going to close this issue. Must have gotten fixed somewhere along the line.
lock commentedon Mar 31, 2018
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!