godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.53k stars 151 forks source link

Improve CI to check for grammar/highlighting issues #417

Closed DaelonSuzuka closed 6 months ago

DaelonSuzuka commented 2 years ago

Godot version

n/a

VS Code version

n/a

Godot Tools VS Code extension version

n/a

System information

n/a

Problem statement

Syntax highlighting and grammar files currently have no automated checking of any kind.

Proposed solution

Find or build an automated test system for language grammars and syntax highlighting.

Actually testing the output of the syntax highlighting sounds ridiculously difficult and/or tedious, but effort on #415 and #416 has revealed a process we can use that's at least better than nothing.

The Linguist tool has a process for compiling VSCode grammars that validates them syntactically. This process is outlined here.

I think the full process is probably not appropriate for our CI, because I had to run their bootstrap script, which downloads several hundred grammars from the internet, and then manually replace the grammar files it downloads from (presumably) our master branch with the grammar files that I'm trying to test.

I'll investigate stripping down their setup scripts to make a smaller testing tool, or making a new tool using the same process but just targeting one folder of grammar files.

DaelonSuzuka commented 2 years ago

I found a tool for testing TextMate grammars here. This looks relatively janky/tedious, but if it works it's worth looking in to.

Additionally, Linguist contains links to many other projects that maintain grammars. It seems likely that one or more of those projects have dealt with this issue and have a solution we can steal use.