Skip to content

Textual CSS Tree-sitter grammar/parser #4563

@b4shful

Description

@b4shful

I've seen there is a Textual CSS VSCode Extension based on the TCSS TextMate Grammar.

It would be great if a Tree-sitter grammar was also made available. I am unfamiliar with this so I'm not sure how difficult it would be to create a Tree-sitter grammar from the existing TextMate grammar. It probably wouldn't be as easy as a simple conversion as Tree-sitter creates a full syntax tree, but the documentation is apparently very good.

What I do know is that having a Tree-sitter parser would enable a wide range of editor support, for example getting TCSS in the nvim-treesitter project would allow for syntax highlighting, incremental selection, indentation and folding without having to develop a specific plugin for Neovim (and even then, a lot might be able to be derived from the preexisting CSS and/or SCSS parsers. It also wouldn't require any working with LSP etc. but you still get some of the functionality expected from LSPs.

Tree-sitter is becoming quite popular too, apparently used by Atom (RIP), Emacs, Neovim, Lapce, Zed and Helix. So, while personally I'm interested in Neovim support/integrations, Tree-sitter support benefits a lot of different editors :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions