Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vim plugin highlights single line comments nested within a multi line comment #12307

Closed
sfackler opened this issue Feb 16, 2014 · 5 comments · Fixed by #12308
Closed

Vim plugin highlights single line comments nested within a multi line comment #12307

sfackler opened this issue Feb 16, 2014 · 5 comments · Fixed by #12308

Comments

@sfackler
Copy link
Member

Something like this will highlight the //github.com/mozilla/rust part as if it were a single line comment.

/*
http://github.com/mozilla/rust
*/
@lilyball
Copy link
Contributor

You're right. This isn't noticeable by default, since rustCommentBlock is highlighted the same way as rustCommentLine with the default configuration.

@lilyball
Copy link
Contributor

Similarly the construct /*/**/*/ also mis-parses and considers the rest of the document commented out.

@lilyball
Copy link
Contributor

Apparently /*/**/*/ is unsolvable in Vim's syntax mechanism, which is explained in a long comment, but boils down to the fact that Vim prioritizes a pattern start over a pattern end even if the end starts earlier than the start (this is an issue if they overlap).

@lilyball
Copy link
Contributor

Well, to clarify, it's unsolvable if you try and solve /* */*. Somehow I have it in a state right now where /*/**/*/ actually works, although /* */* is still broken.

@chris-morgan
Copy link
Member

When I implemented comment nesting for Vim, I did it that way on purpose. It may have been misguided (I'm gently inclined to think it was, though still I think that differentiating nested comments is a convenient feature), but it was deliberate.

matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this issue Mar 21, 2024
New lint `const_is_empty`

This lint detects calls to `.is_empty()` on an entity initialized from a string literal and flag them as suspicious. To avoid triggering on macros called from generated code, it checks that the `.is_empty()` receiver, the call itself and the initialization come from the same context.

Fixes rust-lang#12307

changelog: [`const_is_empty`]: new lint
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 a pull request may close this issue.

3 participants