zed icon indicating copy to clipboard operation
zed copied to clipboard

More extensible language registration

Open SlashScreen opened this issue 1 year ago • 0 comments

Check for existing issues

  • [X] Completed

Describe the feature

I looked for this as an issue already, but if I didn't find one that exists under the keywords I searched, disregard.

I noticed that Tailwind is being manually bound to any language that might use it, as well as other languages being manually written into the code base. I don't thing I have to say that this is remarkably inextensible. I'm sure there are plans to change this in the future, but I wanted to start a discussion on how this could be done in the future.

I would make a PR myself, but I don't have a working mac to test builds on.

If applicable, add mockups / screenshots to help present your vision of the feature

My own, perhaps naive, idea for how it might work is to simply ship with a config file of some kind, whether that be TOML, YAML, or JSON. (I personally think YAML is much easier to read and edit, but Serde is already in the project, so.) Then, during init, the file is read and languages registered as requested.

Perhaps it could look something like this (using erb as an example):

languages:
    - erb
        sitter: embedded # for `tree_sitter_embedded_template::language(),`
        lsp: # For the vector
            - ruby
            - tailwind

That also leaves which key in the yaml file goes to which LSP in the code, which is something that may also need to go in a config file somewhere, since plugins for other LSPs should be viable, right?

Let me know your thoughts.

SlashScreen avatar Jan 26 '24 09:01 SlashScreen