You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When JS is used as the lang for a Svelte component script, either explicitly (<script lang="js">) or implicitly (<script>), presence of ?. or ?? in the script breaks syntax highlighting or the part of the code after the script (with the markup apparently highlighted with JS rules).
For example, this snippet breaks:
<script>
constx= a?.b</script><div>Hello</div>
Or this one:
<script>
constx= a ?? b</script><div>Hello</div>
Oh? This even breaks in Github! What grammar are they using?
But with our new grammar this works (not on Github -- what the hell??):
<scriptlang="ts">
const x =a??b
</script>
<div>Hello</div>
I have confirmed that changing source.js injections to source.ts fixes the problem, so that seems to indicate that the problem originates in the language-javascript grammar. Or maybe an incompatibility between something it contains and Atom's (and Github's?) implementation of TextMate grammars.
So an easy fix would be to change all injections of source.js to source.ts in our grammar. language-typescript is a core grammar bundled with Atom, so everyone should have it. But this fix would mean JS only users would noticeably get a different highlighting of their JS Svelte components and their standard .js files.
Would that be acceptable, at least as a temporary quick fix?
The text was updated successfully, but these errors were encountered:
When JS is used as the lang for a Svelte component script, either explicitly (
<script lang="js">
) or implicitly (<script>
), presence of?.
or??
in the script breaks syntax highlighting or the part of the code after the script (with the markup apparently highlighted with JS rules).For example, this snippet breaks:
Or this one:
Oh? This even breaks in Github! What grammar are they using?
But with our new grammar this works (not on Github -- what the hell??):
I have confirmed that changing
source.js
injections tosource.ts
fixes the problem, so that seems to indicate that the problem originates in thelanguage-javascript
grammar. Or maybe an incompatibility between something it contains and Atom's (and Github's?) implementation of TextMate grammars.So an easy fix would be to change all injections of
source.js
tosource.ts
in our grammar.language-typescript
is a core grammar bundled with Atom, so everyone should have it. But this fix would mean JS only users would noticeably get a different highlighting of their JS Svelte components and their standard.js
files.Would that be acceptable, at least as a temporary quick fix?
The text was updated successfully, but these errors were encountered: