svelte-vscode

Svelte language support for VS Code

Github星跟蹤圖

Work is being continued in the official svelte language-tools repo

Svelte for VS Code

Provides syntax highlighting and rich intellisense for Svelte components in VS Code, utilising the svelte language server.

Features

  • Svelte
    • Diagnostic messages for warnings and errors
    • Support for svelte preprocessors that provide source maps
    • Svelte specific formatting (via prettier-plugin-svelte)
  • HTML
    • Hover info
    • Autocompletions
    • Emmet
    • Symbols in Outline panel
  • CSS / SCSS / LESS
    • Diagnostic messages for syntax and lint errors
    • Hover info
    • Autocompletions
    • Formatting (via prettier)
    • Emmet
    • Color highlighting and color picker
    • Symbols in Outline panel
  • TypeScript / JavaScript
    • Diagnostics messages for syntax errors, semantic errors, and suggestions
    • Hover info
    • Formatting (via prettier)
    • Symbols in Outline panel
    • Autocompletions
    • Go to definition
    • Code Actions

Using with preprocessors

Language specific setup

Generic setup

If a svelte file contains some language other than html, css or javascript, svelte-vscode needs to know how to preprocess it. This can be achieved by creating a svelte.config.js file at the root of your project which exports a svelte options object (similar to svelte-loader and rollup-plugin-svelte).

// svelte.config.js
const preprocess = require('my-example-svelte-preprocessor');

module.exports = {
    preprocess: [preprocess()],
    // ...other svelte options
};

It's also necessary to add a type="text/language-name" or lang="language-name" to your style and script tags, which defines how that code should be interpreted by the extension.

<div>
    <h1>Hello, world!</h1>
</div>

<style type="text/scss">
    div {
        h1 {
            color: red;
        }
    }
</style>

Settings

svelte.language-server.runtime

Path to the node executable you would like to use to run the language server.
This is useful when you depend on native modules such as node-sass as without
this they will run in the context of vscode, meaning v8 version mismatch is likely.

svelte.plugin.typescript.enable

Enable the TypeScript plugin. Default: true

svelte.plugin.typescript.diagnostics

Enable diagnostic messages for TypeScript. Default: true

svelte.plugin.typescript.hover

Enable hover info for TypeScript. Default: true

svelte.plugin.typescript.documentSymbols

Enable document symbols for TypeScript. Default: true

svelte.plugin.typescript.completions

Enable completions for TypeScript. Default: true

svelte.plugin.typescript.definitions

Enable go to definition for TypeScript. Default: true

svelte.plugin.typescript.codeActions

Enable code actions for TypeScript. Default: true

svelte.plugin.css.enable

Enable the CSS plugin. Default: true

svelte.plugin.css.diagnostics

Enable diagnostic messages for CSS. Default: true

svelte.plugin.css.hover

Enable hover info for CSS. Default: true

svelte.plugin.css.completions

Enable auto completions for CSS. Default: true

svelte.plugin.css.documentColors

Enable document colors for CSS. Default: true

svelte.plugin.css.colorPresentations

Enable color picker for CSS. Default: true

svelte.plugin.css.documentSymbols

Enable document symbols for CSS. Default: true

svelte.plugin.html.enable

Enable the HTML plugin. Default: true

svelte.plugin.html.hover

Enable hover info for HTML. Default: true

svelte.plugin.html.completions

Enable auto completions for HTML. Default: true

svelte.plugin.html.tagComplete

Enable HTML tag auto closing. Default: true

svelte.plugin.html.documentSymbols

Enable document symbols for HTML. Default: true

svelte.plugin.svelte.enable

Enable the Svelte plugin. Default: true

svelte.plugin.svelte.diagnostics.enable

Enable diagnostic messages for Svelte. Default: true

svelte.plugin.svelte.format.enable

Enable formatting for Svelte (includes css & js). Default: true

主要指標

概覽
名稱與所有者jamesbirtles/svelte-vscode
主編程語言TypeScript
編程語言TypeScript (語言數: 1)
平台
許可證MIT License
所有者活动
創建於2018-05-01 12:12:36
推送於2020-05-06 19:44:08
最后一次提交2020-05-06 20:44:07
發布數10
最新版本名稱v0.9.3 (發布於 )
第一版名稱v0.2.0 (發布於 )
用户参与
星數208
關注者數11
派生數21
提交數55
已啟用問題?
問題數107
打開的問題數0
拉請求數5
打開的拉請求數0
關閉的拉請求數2
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?