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

[JavaScript] (PR provided) Cruft causing incorrect highlighting for standard JavaScript: Mustache templating, HTML comments, IE conditional compilation #889

Closed
Thom1729 opened this issue Apr 10, 2017 · 1 comment

Comments

@Thom1729
Copy link
Collaborator

Thom1729 commented Apr 10, 2017

The following tests fail:

{{ 42; }}
// ^^ meta.block.js meta.block.js constant.numeric.js

x --> y;
//^^ keyword.operator.arithmetic.js
//  ^ keyword.operator.relational.js

/*@if /*/
//     ^^ punctuation.definition.comment.js

z
// <- variable.other.readwrite.js

Each test is valid JavaScript, but the parsing is broken by code that handles non-JavaScript syntax:

  • Highlighting for mustache templates conflicts with JavaScript blocks. This is fundamentally unfixable; the two languages conflict. If we want to maintain mustache embedding in JavaScript code for some reason, we can make a new syntax for it (simply including JavaScript with a with_prototype). Or, if it's not worth having a separate syntax for, it's probably not worth breaking the JavaScript syntax for.
  • Highlighting for HTML comments conflicts with JavaScript operators. This could conceivably be patched, because <!-- cannot conflict with real JavaScript at top level. But the implementation seems rather pointless to begin with, because it can't cover all uses of HTML comments (e.g. in strings) without breaking JavaScript and the HTML syntax should handle this anyway using with_prototype.
  • Highlighting for ancient IE conditional compilation breaks JavaScript comments. This is an ill-advised and archaic practice that has long been abandoned by Microsoft, so it should be safe to just cut it.

Fixing these will help to clear the way for #885 and related issues.

@Thom1729 Thom1729 changed the title [JavaScript] Cruft: Mustache templating, HTML comments, IE conditional compilation [JavaScript] Cruft causing incorrect highlighting for standard JavaScript: Mustache templating, HTML comments, IE conditional compilation Apr 10, 2017
@Thom1729 Thom1729 changed the title [JavaScript] Cruft causing incorrect highlighting for standard JavaScript: Mustache templating, HTML comments, IE conditional compilation [JavaScript] (PR provided) Cruft causing incorrect highlighting for standard JavaScript: Mustache templating, HTML comments, IE conditional compilation Apr 11, 2017
@Thom1729
Copy link
Collaborator Author

I'm closing this. The three bugs described here are addressed in more detail elsewhere.

Mustache templates: #927
HTML comments: #928
IE conditional compilation: TBD

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

No branches or pull requests

1 participant