Skip to content

Fixed single-line comment detection not recognizing line breaks as the end of the comment#79

Closed
frnsys wants to merge 3 commits into
pangloss:masterfrom
frnsys:master
Closed

Fixed single-line comment detection not recognizing line breaks as the end of the comment#79
frnsys wants to merge 3 commits into
pangloss:masterfrom
frnsys:master

Conversation

@frnsys

@frnsys frnsys commented May 28, 2013

Copy link
Copy Markdown

I was having an issue where comment highlighting was being applied to lines following single line comments.

For example:

function foo(x, y) {
  // This is a comment
  return x + y;
}

Everything under the comment would be interpreted as a comment as well.

I just removed \n from the skip regex pattern for jsLineComment, and that fixed things.

@goatslacker

Copy link
Copy Markdown
Collaborator

I actually like this behavior but don't feel too strong about it. If you can gather some support for your pull I'll merge it. Otherwise I'll accept a pull if you make it so when you press a single backspace it removes the comments.

@frnsys

frnsys commented May 29, 2013

Copy link
Copy Markdown
Author

I might be misunderstanding how that was meant to be used, is there a reason that the new lines aren't recognized as the end of the comment?

@goatslacker

Copy link
Copy Markdown
Collaborator

Many instances, but it all boils down to: when writing multiline comments without having to use /**/

@frnsys

frnsys commented May 29, 2013

Copy link
Copy Markdown
Author

But those line's wouldn't be interpreted as comments by the interpreter, would they?
Also, how do you mark the end of a comment block then?

Thanks!

Francis Tseng added 2 commits June 11, 2013 10:37
@laughinghan

Copy link
Copy Markdown

Just to clarify: @goatslacker I think you might be thinking is that in the snippet

function foo(x, y) {
  // This is a comment|<- the cursor
  return x + y;
}

when the cursor is at the end of the comment and you hit Enter, you could arguably want the result to be:

function foo(x, y) {
  // This is a comment
  // |<- the cursor
  return x + y;
}

I believe @Ftzeng is not arguing against that behavior. I believe the bug @Ftzeng is reporting is that the line return x + y; is being grayed out and highlighted like it's a comment, even though it's syntactically not a comment.

@Ftzeng: I am unable to reproduce this bug on the latest master branch of pangloss/vim-javascript? Also, your later additional commits appear to be unrelated (I also happen to disagree with them).

My vote is to close this issue.

@frnsys

frnsys commented Jul 2, 2013

Copy link
Copy Markdown
Author

That's exactly the issue I was having. I will try again with the latest commit.

Yeah the additional commits are unrelated, I was just messing around with some things.

@frnsys frnsys closed this Jul 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants