Svelte Language Server screenshot

Svelte Language Server

Author Avatar Theme by Jamesbirtles
Updated: 6 May 2020
97 Stars

A WIP language server for Svelte

Overview

The Svelte Language Server is a language server protocol implementation that provides language-specific support for the Svelte framework. It allows editor and addon developers to add features such as diagnostics, auto-complete, and formatting to any editor without reinventing the wheel.

Features

  • Diagnostic messages: Provides warning and error messages specific to Svelte.
  • Svelte specific formatting: Supports formatting code using the prettier-plugin-svelte.
  • HTML support: Includes support for HTML code using the vscode-html-languageservice.
  • Hover info: Provides information on hover for Svelte code.
  • Autocompletions: Offers suggestions for code completions.
  • Emmet support: Integration with Emmet for faster HTML and CSS coding.
  • Symbols in Outline panel: Displays symbols in the outline panel for easy navigation.
  • CSS / SCSS / LESS support: Supports CSS, SCSS, and LESS code using the vscode-css-languageservice.
  • TypeScript / JavaScript support: Provides diagnostics, hover info, formatting, symbols, and code actions for TypeScript and JavaScript using TypeScript.

Installation

To use the Svelte Language Server, you need to install a plugin for your editor. Currently, the following editors are supported:

VS Code

  1. Open VS Code
  2. Go to the extensions panel (Ctrl + Shift + X)
  3. Search for “Svelte Language Server” and click install

Atom

  1. Open Atom
  2. Go to the package manager (Ctrl + Shift + P)
  3. Search for “Svelte Language Server” and click install

(Neo)Vim

  1. Open (Neo)Vim
  2. Install a plugin manager if you don’t have one already (e.g., Plug, Vundle)
  3. Add the following line to your vimrc:
    Plug 'sveltejs/language-tools', { 'do': 'yarn install --lock-file', 'for': 'svelte' }
    
  4. Run :PlugInstall to install the plugin

Summary

The Svelte Language Server is a powerful tool for Svelte developers that allows for language-specific features and smart support in any editor. With support for diagnostics, formatting, autocompletions, and more, it enhances the development experience for Svelte projects. By providing a plugin for popular editors like VS Code, Atom, and (Neo)Vim, it ensures easy installation and usage for developers.