sveltejs / language-tools

The Svelte Language Server, and official extensions which use it
MIT License
1.26k stars 202 forks source link

Preconfigure emmet.includeLanguages so it works with svelte out of the box when the extension is installed. #2509

Open UltraCakeBakery opened 2 months ago

UltraCakeBakery commented 2 months ago

Description

With fresh installs of vscode, you have to manually configure your vscode for emmet to work in svelte, as emmet does not automatically recognize svelte components as HTML.

Proposed solution

The extension when installed should by default apply this setting to vscode:

    "emmet.includeLanguages": {
        "svelte": "html"
    },

Alternatives

Add a command to apply recommended default settings, including the one mentioned above if adding this by default is not preferred.

Additional Information, eg. Screenshots

No response

jasonlyu123 commented 2 months ago

We do have emmet autocomplete and some special handling so I don't think we'll preconfigure the config. That said vue does seems to support emmet commands without needed the config so I'll probably check if we can do the same. If not we can probably considering about the command in the "Alterantives" selection but there is a big problem with feature discovery with this approch.

jasonlyu123 commented 2 months ago

Vue actually doesn't have a special handling for it. It works because the Textmate grammar embeds HTML. Textmate grammar was mainly used in syntax highlight and some embedded language support. However, we went with another approach with a simplified HTML grammar probably because some syntax is not strictly HTML compliant. For example, the arrow in the event handler.

So if we're doing this we might go with the approach in the "Alternatives" section. But as mentioned earlier, there is a feature discovery issue. One is that you won't know the command exists. If users rely on custom keybinding. There's no chance for them to discover the command.