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

Add Astro language #5460

Merged
merged 13 commits into from
Jul 19, 2021
Merged

Add Astro language #5460

merged 13 commits into from
Jul 19, 2021

Conversation

Nixinova
Copy link
Contributor

@Nixinova Nixinova commented Jul 13, 2021

Resolve #5459

Description

Adds the language used in the Astro static site generator.

Checklist:

  • I am adding a new language.
    • The extension of the new language is used in hundreds of repositories on GitHub.com.
    • I have included a real-world usage sample for all extensions added in this PR:
    • I have included a syntax highlighting grammar (preview) (preview)
    • I have updated the heuristics to distinguish my language from others using the same extension.

@Nixinova Nixinova requested a review from a team as a code owner July 13, 2021 08:28
@lildude
Copy link
Member

lildude commented Jul 14, 2021

From #5459

.astro - 1006 repos - using Harvester I got through 467 files before being rate limited and had 101 unique repos, so extrapolating that there should be over 200 unique out of that 1K.

Close, but not quite yet:

Total files found: 1053
Unique public user/repos: 192
Unique owners: 163

@Nixinova
Copy link
Contributor Author

Surely it'll be at 200 by, like, tomorrow then

@natemoo-re
Copy link

@Nixinova 👋🏻 Astro maintainer here, thanks for opening this PR! I'm having some trouble accessing your grammar to check it for correctness. At any rate, we'd definitely prefer to point to the official Astro tmLanguage file if possible.

@Nixinova
Copy link
Contributor Author

Nixinova commented Jul 16, 2021

.astro - 1006 repos

Its now at 1404 - Astro is growing very quickly. So surely theres 8 new repos in the last day - I can even count them manually: 1 2 3 4 5 6 7 8 - there.

we'd definitely prefer to point to the official Astro tmLanguage file if possible.

Done

@lildude
Copy link
Member

lildude commented Jul 19, 2021

All good now:

Total files found: 1542
Unique public user/repos: 221
Unique owners: 194

@lildude
Copy link
Member

lildude commented Jul 28, 2021

Whoops, looks like someone forced the switch to the Astro provided grammar without checking the output or using the provided script and thus missed the fact it has syntax errors and thus doesn't compile:

- [ ] repository `vendor/grammars/astro` (from https://github.com/snowpackjs/astro) (8 errors)
    - [ ] Grammar conversion failed. File `tools/vscode/syntaxes/astro.tmLanguage.json` failed to parse: 13 error(s) decoding:

* 'Patterns[12].Patterns[1].Patterns[1].Captures' expected a map, got 'slice'
* 'Patterns[4].Captures' expected a map, got 'slice'
* 'Patterns[5].Captures' expected a map, got 'slice'
* 'Repository[astro-expressions].Patterns[0].BeginCaptures' expected a map, got 'slice'
* 'Repository[astro-expressions].Patterns[0].EndCaptures' expected a map, got 'slice'
* 'Repository[string-double-quoted].BeginCaptures' expected a map, got 'slice'
* 'Repository[string-double-quoted].EndCaptures' expected a map, got 'slice'
* 'Repository[string-single-quoted].BeginCaptures' expected a map, got 'slice'
* 'Repository[string-single-quoted].EndCaptures' expected a map, got 'slice'
* 'Repository[tag-id-attribute].Patterns[0].BeginCaptures' expected a map, got 'slice'
* 'Repository[tag-id-attribute].Patterns[0].EndCaptures' expected a map, got 'slice'
* 'Repository[tag-id-attribute].Patterns[1].BeginCaptures' expected a map, got 'slice'
* 'Repository[tag-id-attribute].Patterns[1].EndCaptures' expected a map, got 'slice'

This means that whilst support will be added for Astro in the next release, which I'm in the process of putting together and testing, it'll mean there will be no syntax highlighting.

I can delay the release if this can be fixed by Monday morning 🇬🇧 time, else I'll need to revert this PR.

@matthewp
Copy link

Thanks @lildude, I think we can make your deadline. Is there a tool you know of to verify the syntax is correct? Otherwise we'll just assume its all of these captures.

@Nixinova
Copy link
Contributor Author

Nixinova commented Jul 28, 2021

Fixed with withastro/astro#926 - the Astro team is quick

@jasikpark
Copy link

Does the git submodule in the repo need to be updated now, or does linguist just pull the lastest version of the specified file?

@lildude
Copy link
Member

lildude commented Jul 29, 2021

Does the git submodule in the repo need to be updated now, or does linguist just pull the lastest version of the specified file?

Nope. We update as part of making each release; that's how I spotted this.

Just pulled the latest SHA and things are looking much better - there are a couple of warnings about missing includes because the grammar is attempting to use scopes Linguist doesn't know about (they appear to be grammars supplied by VSCode), but that's not a major issue and only means some parts may not highlight as expected.

Thanks for the quick turnaround everyone 🙇.

@matthewp
Copy link

Thanks @lildude, are you using Lightshow to test the grammar? If so we can improve it on our end using that.

@lildude
Copy link
Member

lildude commented Jul 29, 2021

@matthewp Nope. I'm using our grammar compiler (step 3i in the release process) and it has a bunch of checks. This is what picked up the problems with the grammar.

@jasikpark
Copy link

hopefully we can pull that in to lint our own grammar?

@jasikpark
Copy link

When I click on "Astro" in the language breakdown, I navigate to https://github.com/snowpackjs/astro/search?l=astro, but I get "astro language not found"... is there something wrong with our config or does a different project need Astro added too?

@Nixinova
Copy link
Contributor Author

astro language not found

GitHub Search isn't updated at the same time Linguist is and is synced less often.

@lildude
Copy link
Member

lildude commented Aug 13, 2021

Further to @Nixinova's response… search uses go-enry which lags behind Linguist updates by quite a margin as it's a manual process subject to someone noticing or wanting the latest Linguist languages. They're currently inline with Linguist v7.14.0.

@github-linguist github-linguist locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Astro language
5 participants