Skip to content

Overview of current features of language server + limitations #83

@dummdidumm

Description

@dummdidumm
Member

This is an overview of the current state of the svelte-language-server - what it already can do, what it cannot, yet. If you feel a feature is missing or something that should work according to this list does not work, open a new issue.

HTML

autocompletion / auto imports

  • autocompletion for normal html tags
    autocompletion for special svelte tags like <svelte:window>
    autocompletion for special svelte tags like #await

hover info

  • hover info for normal html tags
    hover info for special svelte tags like <svelte:window>
    hover info for special svelte tags like #await

CSS

  • support for CSS/Less/SCSS

autocompletion / auto imports

  • autocompletion for css tags
    autocompletion for :global tag
    autocompletion for ids/classes/svelte component tags in css that are present in template (Class completion for CSS #84)
    autocompletion for ids/classes in template that are present in css (completion for ids/classes in the template #844, for CSS/Less/SCSS)
    autocompletion for ids/classes in template moustache tags like class that are present in css (completion for ids/classes in the template #844)

hover info

  • hover info for css tags

go to definition

  • go to definition from class in template to css
    go to definition from class in template moustache tags like class to css
    go to definition from css to template

Javascript / Typescript

go to definition

typechecking

autocompletion / auto imports

code actions

Cross-cutting

code-actions

Limitations

The compiler is not designed for an editor.

See sveltejs/svelte#4818.

During editing, the likelihood that the code is invalid is very high. But the svelte compiler is designed to throw syntax errors to warn the user. Thus the features that rely on the svelte compiler won't work when there's a syntax error.

We did consider writing a dedicated parser for the editor but that seems to be too much work and maintenance burden. So it's not a priority, but we don't say it won't ever happen.

TypeScript language service is synchronous.

The Typescript's language service is mostly synchronous so we can't preprocess code before handing it off to svelte2tsx, because that's asynchronous (#339). That hinders features such as better Pug support. That's also one of the big roadblocks of eslint-plugin-svelte3. A svelte.preprocessSync might help, but was decided against for now.

Another problem that arises from the synchronous language service is the effort required to implement a TypeScript plugin (#580) which would help crossing the boundaries of TS/JS/Svelte and enable features such as "start rename in a TS file, Svelte files get updated, too". Even if we ignore preprocessing, the process of intellisense is still asynchronous because we use source-map to map the source code positions which is asynchronous.

Activity

locked and limited conversation to collaborators on May 12, 2020
pinned this issue on May 12, 2020
changed the title [-]Overview of current features of language server[/-] [+]Overview of current features of language server + limitations[/+] on Feb 10, 2021
unpinned this issue on Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @dummdidumm

        Issue actions

          Overview of current features of language server + limitations · Issue #83 · sveltejs/language-tools