Open enzy opened 6 years ago
I notice problems in vim.
E.g. each x in xs
the in
is never keyword-ised.
And in label(for=id)
the for
is keyword-ised.
There are many annoyances like this.
Having a standardised syntax file which is maintained by the language developers is always a fantastic idea. IMHO, however, it may be impractical, as there really is no 'standard' syntax definition file which is widely accepted. Although '.tmLanguage' files can be read by several code editors - and its specifications implemented to a certain degree - there are usually caveats and restrictions. Most of these software packages have their own, native syntax file formats, which is really what needs to be used when we want to take full advantage of all the features our chosen editor has to offer.
For instance: with version 3 of Sublime Text, we now have '.sublime-syntax' files, which are much easier to implement, specially for languages where we may have multiple embedded contexts, like Pug. Indeed, the current developer of the Sublime Text ".tmLanguage" file for Pug seems to have abandoned the project, as ".tmLanguage" files are not easy to edit and maintain, and require a form of compilation/transpilation for use with the new Sublime.
Also, for most code editors, users can download 'language packs', which include not only a syntax definition, but also other language specific goodies, such as snippets and code-completion enablers. These often require multiple files, developed and packaged alongside the syntax definition.
This probably explains why, in the majority of cases, language support for different code editors ends up being either the work of the code editor developer - if it's a popular and often-requested language - or by some well-meaning volunteers, which often work in consultation with the language spec developers.
Currently, the 3 most popular code editors around seem to be Sublime Text, VS Code, and Atom. So, perhaps what we need is 3 code editor "Pros", who are already savvy with developing syntax files and language packages for their favourite editor, and who can setup 3 (semi-)official repositories for Pug language support for their editors - with support from the Pug team, which could make themselves available if any consultation is required.
If someone wants to contribute and maintain an "official" language file for pug, I'd be happy to have it live in a folder in this repository, but it's not something I personally have time to create/maintain. Please feel free to submit a pull request though.
and also Adobe Brackets, an alternative cool and handy editor.
Every code editor I tried so far has incomplete or incorrect implementation of Pug syntax. Thus development with Pug lacks proper tooling, often breaks without a reason and is inefficient.
One way to solve this would be maintaining official grammar under pugjs organization. Like what for ex. TypeScript has. It will allow to join time of contributors together and maintain the single codebase.
The widely used format is the TextMate Language grammar .tmLanguage (which doesn't support context though). All these editors accepts it:
The next step would be to pick the best implementation, fix its issues and start from there.
Ideas, opinions?
❤️