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

Syntax highlighting for $: if( ) { } #2249

Open
hyunbinseo opened this issue Jan 9, 2024 · 2 comments
Open

Syntax highlighting for $: if( ) { } #2249

hyunbinseo opened this issue Jan 9, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@hyunbinseo
Copy link

TL:DR;

Since the syntax highlighting works fine on VS Code, I was assuming that it was a GitHub linguist issue.

However, there was a feedback that it might be the grammar issue. Therefore, submitting this issue.

Reference github-linguist/linguist#6673

Describe the issue

Svelte's $: if( ) { } syntax seems to be broken on github.com.

Currently, lang="ts" is required to correctly highlight this syntax.

image

@dummdidumm
Copy link
Member

Given that it's somewhat of an edge case and that this syntax is going to be less used with Svelte 5+, I'm putting this in the "not that important" category. I also suspect this might have to do with the JS grammar, AFAIK we just reuse it here.

@dummdidumm dummdidumm added the bug Something isn't working label Jan 9, 2024
@jasonlyu123
Copy link
Member

GitHub linguist is using a fork of a fork from an ancient version of svelte-atom. They switched to the latest Svelte atom a while ago but are having some trouble with some injections. They eventually reverted it because they couldn't fix the sunsetted internal highlighting tool they used.

Even if they're using the grammar we're using now, and the embed problem doesn't exist. I don't think it would solve the problem. What I suspect is that they are using some old version of Atom javascript when it comes to HTML-like Textmate grammar, which doesn't support optional chaining.

this also happens to vue

<script>
hi?.();
</script>
<script lang="ts">
hi?.();
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants