<h2 dir="auto">Problem</h2>
<p dir="auto">When you have long lines in a JS file with single line comments at their end strange things happen. The issues happen to me twice today but only in specific cases (each time I was coding a concatenation of variables and strings) so I put examples that only need to be copy and paste.</p>
<h2 dir="auto">Configuration</h2>
<p dir="auto">Atom version 0.165.0<br>
Mac OS X version 10.10.2.<br>
File in JS language and encoded in UTF-8.</p>
<h2 dir="auto">Examples</h2>
<h4 dir="auto">1) Second line commented</h4>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$(&quot;#answer-&quot; + (maxAnswers + 1)).html(&quot;&lt;h1 class=\&quot;help-title\&quot;&gt;&quot; + term.substring(0, wordPos) + &quot;&lt;span class=\&quot;match\&quot;&gt;&quot; + term.substr(wordPos, this.help.val().length) + &quot;&lt;/span&gt;&quot; + &quot;test&quot;.substring(this.help.val().length) + &quot;&lt;/h1&gt;&quot;); // Put the answer in the appropriate div.
$(&quot;#answer-&quot; + (maxAnswers + 1)).html(&quot;&lt;h1 class=\&quot;help-title\&quot;&gt;&quot; + term.substring(0, wordPos) + &quot;&lt;span class=\&quot;match\&quot;&gt;&quot; + term.substr(wordPos, this.help.val().length) + &quot;&lt;/span&gt;&quot; + &quot;test&quot;.substring(this.help.val().length) + &quot;&lt;/h1&gt;&quot; ); // Put the answer in the appropriate div."><pre class="notranslate"><span class="pl-en">$</span><span class="pl-kos">(</span><span class="pl-s">"#answer-"</span> <span class="pl-c1">+</span> <span class="pl-kos">(</span><span class="pl-s1">maxAnswers</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">html</span><span class="pl-kos">(</span><span class="pl-s">"&lt;h1 class=\"help-title\"&gt;"</span> <span class="pl-c1">+</span> <span class="pl-s1">term</span><span class="pl-kos">.</span><span class="pl-en">substring</span><span class="pl-kos">(</span><span class="pl-c1">0</span><span class="pl-kos">,</span> <span class="pl-s1">wordPos</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s">"&lt;span class=\"match\"&gt;"</span> <span class="pl-c1">+</span> <span class="pl-s1">term</span><span class="pl-kos">.</span><span class="pl-en">substr</span><span class="pl-kos">(</span><span class="pl-s1">wordPos</span><span class="pl-kos">,</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">help</span><span class="pl-kos">.</span><span class="pl-en">val</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">length</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s">"&lt;/span&gt;"</span> <span class="pl-c1">+</span> <span class="pl-s">"test"</span><span class="pl-kos">.</span><span class="pl-en">substring</span><span class="pl-kos">(</span><span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">help</span><span class="pl-kos">.</span><span class="pl-en">val</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">length</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s">"&lt;/h1&gt;"</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// Put the answer in the appropriate div.</span>
<span class="pl-en">$</span><span class="pl-kos">(</span><span class="pl-s">"#answer-"</span> <span class="pl-c1">+</span> <span class="pl-kos">(</span><span class="pl-s1">maxAnswers</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">html</span><span class="pl-kos">(</span><span class="pl-s">"&lt;h1 class=\"help-title\"&gt;"</span> <span class="pl-c1">+</span> <span class="pl-s1">term</span><span class="pl-kos">.</span><span class="pl-en">substring</span><span class="pl-kos">(</span><span class="pl-c1">0</span><span class="pl-kos">,</span> <span class="pl-s1">wordPos</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s">"&lt;span class=\"match\"&gt;"</span> <span class="pl-c1">+</span> <span class="pl-s1">term</span><span class="pl-kos">.</span><span class="pl-en">substr</span><span class="pl-kos">(</span><span class="pl-s1">wordPos</span><span class="pl-kos">,</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">help</span><span class="pl-kos">.</span><span class="pl-en">val</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">length</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s">"&lt;/span&gt;"</span> <span class="pl-c1">+</span> <span class="pl-s">"test"</span><span class="pl-kos">.</span><span class="pl-en">substring</span><span class="pl-kos">(</span><span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">help</span><span class="pl-kos">.</span><span class="pl-en">val</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">length</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s">"&lt;/h1&gt;"</span> <span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// Put the answer in the appropriate div.</span></pre></div>
<p dir="auto">This code in Atom will put the second line in comment:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/2117580/5603634/472a9428-938f-11e4-9ad8-119883c9760a.png"><img src="https://cloud.githubusercontent.com/assets/2117580/5603634/472a9428-938f-11e4-9ad8-119883c9760a.png" alt="capture d ecran 2015-01-03 a 21 26 45" style="max-width: 100%;"></a><br>
The second line has only one comment at its end but the entire looks commented. If you run this code the second line will be executed as it should.</p>
<h4 dir="auto">2) No comment</h4>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$(&quot;#answer-&quot; + (maxAnswers + 1)).html(&quot;&lt;h1 class=\&quot;help-title\&quot;&gt;&quot; + term.substring(0, wordPos) + &quot;&lt;span class=\&quot;match\&quot;&gt;&quot; + term.substr(wordPos, this.help.val().length) + &quot;&lt;/span&gt;&quot; + term.substring(wordPos + this.help.val().length) + &quot;&lt;/h1&gt;&quot; + result); // Put the answer in the appropriate div"><pre class="notranslate"><span class="pl-en">$</span><span class="pl-kos">(</span><span class="pl-s">"#answer-"</span> <span class="pl-c1">+</span> <span class="pl-kos">(</span><span class="pl-s1">maxAnswers</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">html</span><span class="pl-kos">(</span><span class="pl-s">"&lt;h1 class=\"help-title\"&gt;"</span> <span class="pl-c1">+</span> <span class="pl-s1">term</span><span class="pl-kos">.</span><span class="pl-en">substring</span><span class="pl-kos">(</span><span class="pl-c1">0</span><span class="pl-kos">,</span> <span class="pl-s1">wordPos</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s">"&lt;span class=\"match\"&gt;"</span> <span class="pl-c1">+</span> <span class="pl-s1">term</span><span class="pl-kos">.</span><span class="pl-en">substr</span><span class="pl-kos">(</span><span class="pl-s1">wordPos</span><span class="pl-kos">,</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">help</span><span class="pl-kos">.</span><span class="pl-en">val</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">length</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s">"&lt;/span&gt;"</span> <span class="pl-c1">+</span> <span class="pl-s1">term</span><span class="pl-kos">.</span><span class="pl-en">substring</span><span class="pl-kos">(</span><span class="pl-s1">wordPos</span> <span class="pl-c1">+</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">help</span><span class="pl-kos">.</span><span class="pl-en">val</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">length</span><span class="pl-kos">)</span> <span class="pl-c1">+</span> <span class="pl-s">"&lt;/h1&gt;"</span> <span class="pl-c1">+</span> <span class="pl-s1">result</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// Put the answer in the appropriate div</span></pre></div>
<p dir="auto">The comment is not correctly displayed:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/2117580/5603657/ba8c720a-9390-11e4-9bc0-87f27c3b7ca3.png"><img src="https://cloud.githubusercontent.com/assets/2117580/5603657/ba8c720a-9390-11e4-9bc0-87f27c3b7ca3.png" alt="capture d ecran 2015-01-03 a 21 37 18" style="max-width: 100%;"></a></p>
<p dir="auto">I opened a Python file with the following line (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="20976125" data-permission-text="Title is private" data-url="https://github.com/atom/atom/issues/963" data-hovercard-type="pull_request" data-hovercard-url="/atom/atom/pull/963/hovercard" href="https://github.com/atom/atom/pull/963">#963</a>):</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="                    PrintAndLog(u&quot;SSID: &quot; + RememberedNetwork[&quot;SSIDString&quot;].decode(&quot;utf-8&quot;) + u&quot; - BSSID: &quot; + RememberedNetwork[&quot;CachedScanRecord&quot;][&quot;BSSID&quot;] + u&quot; - RSSI: &quot; + str(RememberedNetwork[&quot;CachedScanRecord&quot;][&quot;RSSI&quot;]) + u&quot; - Last connected: &quot; + str(RememberedNetwork[&quot;LastConnected&quot;]) + u&quot; - Security type: &quot; +  RememberedNetwork[&quot;SecurityType&quot;] + u&quot; - Geolocation: &quot; + Geolocation, &quot;INFO&quot;)"><pre class="notranslate">                    <span class="pl-v">PrintAndLog</span>(<span class="pl-s">u"SSID: "</span> <span class="pl-c1">+</span> <span class="pl-v">RememberedNetwork</span>[<span class="pl-s">"SSIDString"</span>].<span class="pl-en">decode</span>(<span class="pl-s">"utf-8"</span>) <span class="pl-c1">+</span> <span class="pl-s">u" - BSSID: "</span> <span class="pl-c1">+</span> <span class="pl-v">RememberedNetwork</span>[<span class="pl-s">"CachedScanRecord"</span>][<span class="pl-s">"BSSID"</span>] <span class="pl-c1">+</span> <span class="pl-s">u" - RSSI: "</span> <span class="pl-c1">+</span> <span class="pl-en">str</span>(<span class="pl-v">RememberedNetwork</span>[<span class="pl-s">"CachedScanRecord"</span>][<span class="pl-s">"RSSI"</span>]) <span class="pl-c1">+</span> <span class="pl-s">u" - Last connected: "</span> <span class="pl-c1">+</span> <span class="pl-en">str</span>(<span class="pl-v">RememberedNetwork</span>[<span class="pl-s">"LastConnected"</span>]) <span class="pl-c1">+</span> <span class="pl-s">u" - Security type: "</span> <span class="pl-c1">+</span>  <span class="pl-v">RememberedNetwork</span>[<span class="pl-s">"SecurityType"</span>] <span class="pl-c1">+</span> <span class="pl-s">u" - Geolocation: "</span> <span class="pl-c1">+</span> <span class="pl-v">Geolocation</span>, <span class="pl-s">"INFO"</span>)</pre></div>
<p dir="auto">Which led to the following bug:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/e06069206d526a16adf21e84cd179f1185d3fb5e0f05fea4d4b4a08a978092f4/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f34343737342f323331333737382f37366262346262612d613330642d313165332d396136342d3831663666393163323563342e706e67"><img src="https://camo.githubusercontent.com/e06069206d526a16adf21e84cd179f1185d3fb5e0f05fea4d4b4a08a978092f4/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f34343737342f323331333737382f37366262346262612d613330642d313165332d396136342d3831663666393163323563342e706e67" alt="screen shot 2014-03-03 at 2 52 40 pm" data-canonical-src="https://f.cloud.github.com/assets/44774/2313778/76bb4bba-a30d-11e3-9a64-81f6f91c25c4.png" style="max-width: 100%;"></a></p>
<p dir="auto">You can find this as the main file in <a href="https://github.com/jipegit/OSXAuditor/blob/master/osxauditor.py"><code class="notranslate">osxauditor.py</code></a>.</p>