⚠️ Deprecation Notice: This repo is being deprecated, in favor of a fork of the official coc-svelte. Until #8 gets merged, please feel free to use my fork of coc-svelte.
Forked from svelte-vscode
Provides syntax highlighting and rich intellisense for Svelte components in CoC, utilising the svelte language server.
Do you want to use Typescript/SCSS/Less/..? See "Using with preprocessors" below.
If you added "files.associations": {"*.svelte": "html" } to your CoC settings, remove it.
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). It's recommended to use the official svelte-preprocess package which can handle many languages.
// svelte.config.js
const sveltePreprocess = require('svelte-preprocess');
module.exports = {
preprocess: sveltePreprocess(),
// ...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>
svelte.language-server.runtimePath 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.language-server.portAt which port to spawn the language server. Can be used for attaching to the process for debugging / profiling. If you experience crashes due to "port already in use", try setting the port. -1 = default port is used.
svelte.plugin.typescript.enableEnable the TypeScript plugin. Default: true
svelte.plugin.typescript.diagnosticsEnable diagnostic messages for TypeScript. Default: true
svelte.plugin.typescript.hoverEnable hover info for TypeScript. Default: true
svelte.plugin.typescript.documentSymbolsEnable document symbols for TypeScript. Default: true
svelte.plugin.typescript.completionsEnable completions for TypeScript. Default: true
svelte.plugin.typescript.definitionsEnable go to definition for TypeScript. Default: true
svelte.plugin.typescript.codeActionsEnable code actions for TypeScript. Default: true
svelte.plugin.css.enableEnable the CSS plugin. Default: true
svelte.plugin.css.diagnosticsEnable diagnostic messages for CSS. Default: true
svelte.plugin.css.hoverEnable hover info for CSS. Default: true
svelte.plugin.css.completionsEnable auto completions for CSS. Default: true
svelte.plugin.css.documentColorsEnable document colors for CSS. Default: true
svelte.plugin.css.colorPresentationsEnable color picker for CSS. Default: true
svelte.plugin.css.documentSymbolsEnable document symbols for CSS. Default: true
svelte.plugin.html.enableEnable the HTML plugin. Default: true
svelte.plugin.html.hoverEnable hover info for HTML. Default: true
svelte.plugin.html.completionsEnable auto completions for HTML. Default: true
svelte.plugin.html.tagCompleteEnable HTML tag auto closing. Default: true
svelte.plugin.html.documentSymbolsEnable document symbols for HTML. Default: true
svelte.plugin.svelte.enableEnable the Svelte plugin. Default: true
svelte.plugin.svelte.diagnostics.enableEnable diagnostic messages for Svelte. Default: true
svelte.plugin.svelte.format.enableEnable formatting for Svelte (includes css & js). Default: true
svelte.plugin.svelte.hover.enableEnable hover info for Svelte (for tags like #if/#each). Default: true
svelte.plugin.svelte.completions.enableEnable autocompletion for Svelte (for tags like #if/#each). Default: true
svelte.plugin.svelte.rename.enableEnable rename functionality (rename svelte files or variables inside svelte files). Default: true