Support for the Templ Programming Language
Directory: ./grammars
zip -rqq ../tm-bundle.zip *
mv ../tm-bundle.zip ../src/main/resources/
This project uses Grammar-Kit for code generating the parser and lexer. A good starting point to understand how this works is following the Grammar-Kit documentation and the official Custom Language Support Tutorial. Another useful thing to know is that the HTML support is implemented with TemplFileViewProvider implementing the TemplateLanguageFileViewProvider following the custom templating language plugin tutorial. We use HTML_FRAGMENT
Lexer tokens for the HTML parts of the templ files.
If this plugin does not parse Templ files correctly, a good starting point is to look at the output of "View PSI Structure of Current File..."-action to see how the file is parsed. If the Lexical token is incorrect at the point of the parsing error, you need to fix the lexer.
Run Plugin
configuration to see if the lexer works as expected. You can also run the lexer test and preferably add a new test case for the bug.If the lexer token is correct, you need to modify the grammar which generates the parser code.
Generate Parser Code
action to generate the parser code. This also generates the PSI classes but does not remove the old ones, so you might want to remove the ./src/main/gen/com/templ/templ/psi
directory before running this action.Run Plugin
configuration to see if the parser works as expected. You can also run the parser test and preferably add a new test case for the bug.