sway config grammar for tree-sitter
d55ef061 — Hugo Osvaldo Barrera 1 year, 8 months ago
Add an extra note for future reference
a2857812 — Hugo Osvaldo Barrera 1 year, 8 months ago
edffaa72 — Hugo Osvaldo Barrera 1 year, 8 months ago
Implement floating_modifier


browse  log 



You can also use your local clone with git send-email.


A tree-sitter for sway's config style.

This is very incomplete and won't really work except for a few keywords.

If you're interested in seeing this tree-sitter finalised, I'd suggest starting from scratch with something that merely recognise keywords, arguments, comments, blocks and colours. Trying to recognise individual commands and their arguments in the expected format is too much work and not worth it. Also note that colours vs comments might require a bit of attention. I suggest handling font as a special case, and not using comment as an extra rule.

Don't make the same mistakes I did.

Oh, you might want to treat arguments with : different, and also purely-numeric ones too. It'll yield better highlighting results.

This repo is mostly shared as an experiment: it proves that this approach is a bad one. Scientists often publish articles on how they ran an experiment to prove their hypothesis and they were proved wrong. In the same spirit, I hope others wanting to implement this tree-sitter can benefit from using this bad approach as a warning.