question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Comments] Trailing single-line comments are wrapped to the next line

See original GitHub issue

I had a bit of code where a trailing comment was moved to the next line when there’s another statement after the function. This can cause confusion since it requires you to read the comment to know whether it applies to the line before or after and it looks like it would actually cause things like // eslint-disable-line to apply to a different statement.

function foobar() {
	var foo = bar;
	var bar = fooBarBaaz(); // foo all the bars

	var baaz = 'quux';
}

becomes:

function foobar() {
  var foo = bar;
  var bar = fooBarBaaz();
  // foo all the bars
  var baaz = "quux";
}

This does not happen if the comment is on the last line of a function.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:8
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
jlongstercommented, Jan 10, 2017

Comments are probably where most of the subtle bugs are right now. They’re pretty difficult to get right, but this is definitely problematic. I think it’ll take a few weeks to sort out these kinds of bugs, but we’ll get there.

0reactions
jlongstercommented, Jan 26, 2017

See above PR

Read more comments on GitHub >

github_iconTop Results From Across the Web

NeoVim: Single-Line Comments Also Format the Next Line
How to disable auto insertion of comment header when pressing enter, but keep auto insertion of header when auto wrapping comment? 3 ·...
Read more >
4.7 Trailing comments - C Style
Trailing comments describe the action or use of a single line of code. They are usually start (and end) on the same line...
Read more >
How do I create multiline comments in Python? - Stack Overflow
Use arrow keys to select all the lines to be commented. Press Shift+I. Press # (or Shift+3). Press Esc. Share.
Read more >
Single-line and Multi-line Comments in C# | Pluralsight
Single-line comments allow narrative on only one line at a time. Single-line comments can begin in any column of a given line and...
Read more >
Options - Prettier
(If you don't want line wrapping when formatting Markdown, ... This effectively allows using the json5 parser for “JSON with comments and trailing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found