Skip to content

Conversation

@fvsch
Copy link
Contributor

@fvsch fvsch commented Nov 3, 2023

This PR updates the Stylus grammar.

The main motivation for this PR was to convert Stylus.tmLanguage (PLIST) to JSON, for reasons discussed in #5:

  • We've had parsing errors with the XML PLIST format for Vue, and maybe that wasn't about XML-vs-JSON at all, but I’d feel safer with only using JSON since 95%+ of the grammars we use are JSON. Fewer things that can go wrong.
  • In our Enterprise product, we've had some issues where requests for *.tmLanguage URLs would not get appropriate HTTP headers, which was not an issue with *.tmLanguage.json. This should be fixed by now, but again: using common Web formats and file extensions leads to fewer things that can go wrong.

For the source of this updated Stylus grammar, I found two possible sources:

So here I used the second one. If it's good enough for the main Stylus VSCode extension, it should work for us.

Copy link
Contributor

@SamVerschueren SamVerschueren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question on the change in the grammar file. Other than that this looks good. Thanks for looking into this 🙏 !

"grammar": "Stylus.tmLanguage"
"extensions": [".stylus", ".styl"],
"configuration": {
"base": "stylus",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a base stylus grammar on Monaco? Can't recall exactly but I think that's what this is meant for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This configuration object resolves to a path, "stylus/language-configuration.json". If it's not specified, we infer a default path from the language, as ${language}/language-configuration.json.

I’ve taken to make the configuration and grammar paths more explicit instead of convention-based, mostly because I like when stuff is explicit ^^

@fvsch fvsch merged commit c8c9cd6 into main Nov 16, 2023
@fvsch fvsch deleted the fvsch/update-stylus-grammar branch November 16, 2023 17:24
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 this pull request may close these issues.

3 participants