zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
49.04k stars 2.96k forks source link

Emmet with languages that integrate HTML and CSS (SASS, SCSS, LESS, PHP, Twig, Vue, Svelte, Astro etc) #16481

Open saminton opened 2 months ago

saminton commented 2 months ago

Check for existing issues

Describe the feature

The emmet extension is working fine with HTML and CSS files but unfortunately doesn't seem to be working with anything that extends from these two languages. I don't believe there is currently any way to get to "associate" the Emmet extension to other languages. SASS, SCSS and LESS for example can use the exact same emmet snippets as the current CSS implementation, Php, Twig, Vue, Svelte etc can all use the same as the HTML implementation.

I don't expect the team to have to create an implementation for each of these languages (and the many others that exist) but rather if we – the user – could have some way of associating a certain file type to one (or multiple) of the current implementations via a setting it could solve a lot of use cases.

maybe something like the following:

"languages": {
    "Twig": {
        "Emmet": {
            "HTML": true
        }
    },
    "SCSS": {
        "Emmet": {
            "CSS": true
        }
    },
    "Svelte": {
        "Emmet": {
            "HTML": true,
            "CSS": true
        }
    }
}

I have been trying out Zed and I love so many things about it but this is the feature that is preventing me from making the switch. Having to write out "border-top-left-radius: 5px" in it's entirety instead of "btl5" is kinda a deal breaker 😅

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

No response

lougreenwood commented 2 months ago

This is really annoying.

As an extension author, I would also expect that I would be able to do something like one of the following (...my initial thought is that the first one would be ideal).

AlbertMarashi commented 1 month ago

would be nice to get this supporting svelte 🙏🏼

saminton commented 1 month ago

Can we can any feedback from the team on this, is it something that can possibly be integrated ? Even basic SCSS support for starters. Considering it'd be exactly the same as what's already working in CSS files, the extension just needs to be active when in a .scss file.

Although I would love to make the switch to Zed. This feature is currently preventing me (and my team) from doing so.

davidwebca commented 1 month ago

I think (?) I've been able to make it work in Vue.js by putting more specific scopes first in the "lsp.emmet-language-server.settings.languages" (Vue.js was last before this and after changing this and restarting the language servers, it suddenly worked).

{
    "lsp": {
        "emmet-language-server": {
            "settings": {
                "languages": ["Vue.js", "HTML", "PHP", "ERB", "JavaScript", "TSX", "CSS", "Blade"]
            },
        },
    },
}

Instead of

{
    "lsp": {
        "emmet-language-server": {
            "settings": {
                "languages": ["HTML", "PHP", "ERB", "JavaScript", "TSX", "CSS", "Blade", "Vue.js"]
            },
        },
    },
}

Can someone confirm if this works for them in other languages?

lougreenwood commented 1 month ago

Doesn't work for me with the following in .hbs files in an Ember JS Project:

    "emmet-language-server": {
      "settings": {
        "languages": ["Handlebars", "Glimmer", "HTML", "PHP", "ERB", "JavaScript", "TSX", "CSS", "Blade"]
      }
    },

Edit:

i also don't see anything in the logs for emmet language server and I don't see any RPC messages sent for it when I edit a .hbs file.

I restarted Zed after adding this to my config.

davidwebca commented 1 month ago

Mmm nevermind. Indeed, it only worked for a short amount of time over here in the end 🤔

ferrao commented 2 weeks ago

Same thing for Elixir heex files and ~H sigils on ex files.

id-clic commented 1 week ago

Waiting for blade and twig to switch to Zed permanently :-)

ferrao commented 2 days ago

Same thing for Elixir heex files and ~H sigils on ex files.

Someone opened #14149 for this.