coc-svelte
coc-extensionsSvelte language support for coc.nim
Published Package Summary
Svelte for (Neo)Vim
fork from svelte-vscode.
Provides rich intellisense for Svelte components in (neo)vim, utilising the svelte language server.
Install
:CocInstall coc-svelte
You have to install syntax plugin to get syntax highlight and get right filetype, for example
leafOfTree/vim-svelte-plugin
Setup
If you added "files.associations": {"*.svelte": "html" } to your CoC settings, remove it.
Do you want to use TypeScript/SCSS/Less/..? See the docs.
Features
You can expect the following within Svelte files:
- Diagnostic messages
- Support for svelte preprocessors that provide source maps
- Formatting (via prettier-plugin-svelte)
- Hover info
- Autocompletions
- Go to definition
The extension also comes packaged with a TypeScript plugin, which when activated provides intellisense within JavaScript and TypeScript files for interacting with Svelte files.
svelte.plugin.XXX
Settings to toggle specific features of the extension. The full list of all settings is here.
Usage with Yarn 2 PnP
- Run
yarn add -D svelte-language-serverto install svelte-language-server as a dev dependency - Run
yarn dlx @yarnpkg/pnpify --sdk vimto generate or update the Vim/Yarn integration SDKs. - Set the
svelte.language-server.ls-pathsetting in your user configuration, pointing it to the workspace-installed language server. - Restart vim.
- Commit the changes to
.yarn/sdks
- Svelte language support for coc.nim
- onLanguage:svelte
- onCommand:svelte.restartLanguageServer
- onLanguage:javascript
- onLanguage:typescript
Want to build, test, or contribute to coc.nvim extensions? Explore our official SDK and testing toolkits.
Open Developer GuideVersion History
This published npm package does not include a history.md or changelog.md file. Browse its npm versions or repository releases for available release information.
Contributed Commands
All contributes.commands entries from the published package manifest for coc-svelte@0.5.0.
| Command (:CocCommand) | Description |
|---|---|
| svelte.restartLanguageServer | Svelte: Restart Language Server |
| svelte.typescript.findAllFileReferences | Svelte: Find File References |
| svelte.typescript.findComponentReferences | Svelte: Find Component References |
| svelte.kit.generateMultipleFiles | SvelteKit: Create route |
| svelte.kit.generatePage | SvelteKit: Create +page.svelte |
| svelte.kit.generatePageLoad | SvelteKit: Create +page.js/ts |
| svelte.kit.generatePageServerLoad | SvelteKit: Create +page.server.js/ts |
| svelte.kit.generateLayout | SvelteKit: Create +layout.svelte |
| svelte.kit.generateLayoutLoad | SvelteKit: Create +layout.js/ts |
| svelte.kit.generateLayoutServerLoad | SvelteKit: Create +layout.server.js/ts |
| svelte.kit.generateServer | SvelteKit: Create +server.js/ts |
| svelte.kit.generateError | SvelteKit: Create +error.svelte |
Configuration Schema
All contributes.configuration entries from the published package manifest, including each raw property schema for coc-settings.json.
Raw JSON Schema
{
"type": "boolean",
"title": "Enable TypeScript Svelte plugin",
"default": false,
"description": "Enable semantic tokens (semantic highlight) for TypeScript."
}Raw JSON Schema
{
"type": "boolean",
"title": "CSS",
"default": true,
"description": "Enable the CSS plugin"
}Raw JSON Schema
{
"type": "string",
"title": "CSS: Global Files",
"default": "",
"description": "Which css files should be checked for global variables (`--global-var: value;`). These variables are added to the css completions. String of comma-separated file paths or globs relative to workspace root."
}Raw JSON Schema
{
"type": "boolean",
"title": "HTML",
"default": true,
"description": "Enable the HTML plugin"
}Raw JSON Schema
{
"type": "number",
"title": "Language Server Port",
"default": -1,
"description": "- You normally don't set this - At 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."
}Raw JSON Schema
{
"type": "boolean",
"title": "Svelte",
"default": true,
"description": "Enable the Svelte plugin"
}Raw JSON Schema
{
"type": "boolean",
"title": "Language Server Debug Mode",
"description": "- You normally don't set this - Enable more verbose logging for the language server useful for debugging language server execution."
}Raw JSON Schema
{
"type": "boolean",
"title": "Ask to enable TypeScript Svelte plugin",
"default": true,
"description": "Ask on startup to enable the TypeScript plugin."
}Raw JSON Schema
{
"type": "string",
"scope": "application",
"title": "Language Server Path",
"description": "- You normally don't set this - Path to the language server executable. If you installed the \"svelte-language-server\" npm package, it's within there at \"bin/server.js\". Path can be either relative to your workspace root or absolute. Set this only if you want to use a custom version of the language server. This will then also use the workspace version of TypeScript. This setting can only be changed in user settings for security reasons."
}Raw JSON Schema
{
"type": "string",
"scope": "application",
"title": "Language Server Runtime",
"description": "- You normally don't need this - Path to the node executable to use to spawn 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 node version mismatch is likely. Minimum required node version is 12.17. This setting can only be changed in user settings for security reasons."
}Raw JSON Schema
{
"type": "boolean",
"title": "CSS: Hover Info",
"default": true,
"description": "Enable hover info for CSS"
}Raw JSON Schema
{
"type": "boolean",
"title": "HTML: Hover Info",
"default": true,
"description": "Enable hover info for HTML"
}Raw JSON Schema
{
"type": "boolean",
"title": "TypeScript",
"default": true,
"description": "Enable the TypeScript plugin"
}Raw JSON Schema
{
"type": "boolean",
"title": "Svelte: Hover",
"default": true,
"description": "Enable hover information for Svelte"
}Raw JSON Schema
{
"type": "boolean",
"title": "Svelte: Format",
"default": true,
"description": "Enable formatting for Svelte (includes css & js). You can set some formatting options through this extension. They will be ignored if there's any kind of configuration file, for example a `.prettierrc` file."
}Raw JSON Schema
{
"type": "boolean",
"title": "Svelte: Rename",
"default": true,
"description": "Enable rename/move Svelte files functionality"
}Raw JSON Schema
{
"type": "boolean",
"title": "CSS: Auto Complete",
"default": true,
"description": "Enable auto completions for CSS"
}Raw JSON Schema
{
"type": "boolean",
"title": "CSS: Diagnostics",
"default": true,
"description": "Enable diagnostic messages for CSS"
}Raw JSON Schema
{
"type": "boolean",
"title": "HTML: Auto Complete",
"default": true,
"description": "Enable auto completions for HTML"
}Raw JSON Schema
{
"type": "boolean",
"title": "HTML: Tag Auto Closing",
"default": true,
"description": "Enable HTML tag auto closing"
}Raw JSON Schema
{
"type": "object",
"title": "Svelte: Compiler Warnings Settings",
"default": {},
"description": "Svelte compiler warning codes to ignore or to treat as errors. Example: { 'css-unused-selector': 'ignore', 'unused-export-let': 'error'}",
"additionalProperties": {
"enum": [
"ignore",
"error"
],
"type": "string"
}
}Raw JSON Schema
{
"type": "boolean",
"title": "TypeScript: Hover Info",
"default": true,
"description": "Enable hover info for TypeScript"
}Raw JSON Schema
{
"type": "boolean",
"title": "CSS: Document Colors",
"default": true,
"description": "Enable document colors for CSS"
}Raw JSON Schema
{
"type": "boolean",
"title": "CSS: SelectionRange",
"default": true,
"description": "Enable selection range for CSS"
}Raw JSON Schema
{
"type": "boolean",
"title": "Svelte: Code Actions",
"default": true,
"description": "Enable Code Actions for Svelte"
}Raw JSON Schema
{
"type": "boolean",
"title": "Svelte: Completions",
"default": true,
"description": "Enable auto completions for Svelte"
}Raw JSON Schema
{
"type": "boolean",
"title": "Svelte: Diagnostics",
"default": true,
"description": "Enable diagnostic messages for Svelte"
}Raw JSON Schema
{
"type": "boolean",
"title": "CSS: Symbols in Outline",
"default": true,
"description": "Enable document symbols for CSS"
}Raw JSON Schema
{
"type": "boolean",
"title": "HTML: Symbols in Outline",
"default": true,
"description": "Enable document symbols for HTML"
}Raw JSON Schema
{
"enum": [
"none",
"ts"
],
"type": "string",
"title": "Svelte: Default Script Language",
"default": "none",
"description": "The default language to use when generating new script tags"
}Raw JSON Schema
{
"type": "boolean",
"title": "Svelte: Selection Range",
"default": true,
"description": "Enable selection range for Svelte"
}Raw JSON Schema
{
"enum": [
"auto",
"never",
"always"
],
"type": "string",
"default": "auto",
"description": "Show a context menu to generate SvelteKit files. \"always\" to always show it. \"never\" to always disable it. \"auto\" to show it when in a SvelteKit project. "
}Raw JSON Schema
{
"type": "boolean",
"title": "CSS: Color Picker",
"default": true,
"description": "Enable color picker for CSS"
}Raw JSON Schema
{
"type": "boolean",
"title": "TypeScript: Code Actions",
"default": true,
"description": "Enable code actions for TypeScript"
}Raw JSON Schema
{
"type": "boolean",
"title": "TypeScript: Completions",
"default": true,
"description": "Enable completions for TypeScript"
}Raw JSON Schema
{
"type": "boolean",
"title": "TypeScript: Go to Definition",
"default": true,
"description": "Enable go to definition for TypeScript"
}Raw JSON Schema
{
"type": "boolean",
"title": "TypeScript: Diagnostics",
"default": true,
"description": "Enable diagnostic messages for TypeScript"
}Raw JSON Schema
{
"type": "number",
"title": "Svelte Format: Print Width",
"default": 80,
"description": "Maximum line width after which code is tried to be broken up. This is a Prettier core option. If you have the Prettier extension installed, this option is ignored and the corresponding option of that extension is used instead. This option is also ignored if there's any kind of configuration file, for example a `.prettierrc` file."
}Raw JSON Schema
{
"type": "boolean",
"title": "TypeScript: Signature Help",
"default": true,
"description": "Enable signature help (parameter hints) for TypeScript"
}Raw JSON Schema
{
"type": "boolean",
"title": "Svelte Format: Quotes",
"default": false,
"description": "Use single quotes instead of double quotes, where possible. This is a Prettier core option. If you have the Prettier extension installed, this option is ignored and the corresponding option of that extension is used instead. This option is also ignored if there's any kind of configuration file, for example a `.prettierrc` file."
}Raw JSON Schema
{
"type": "boolean",
"title": "TypeScript: Selection Range",
"default": true,
"description": "Enable selection range for TypeScript"
}Raw JSON Schema
{
"type": "boolean",
"title": "TypeScript: Symbols in Outline",
"default": true,
"description": "Enable document symbols for TypeScript"
}Raw JSON Schema
{
"type": "string",
"title": "Svelte Format: Sort Order",
"default": "options-scripts-markup-styles",
"description": "Format: join the keys `options`, `scripts`, `markup`, `styles` with a - in the order you want. This option is ignored if there's any kind of configuration file, for example a `.prettierrc` file."
}Raw JSON Schema
{
"type": "boolean",
"title": "Svelte Format: Strict Mode",
"default": false,
"description": "More strict HTML syntax. This option is ignored if there's any kind of configuration file, for example a `.prettierrc` file."
}Raw JSON Schema
{
"type": "boolean",
"title": "Svelte Format: Allow Shorthand",
"default": true,
"description": "Option to enable/disable component attribute shorthand if attribute name and expression are the same. This option is ignored if there's any kind of configuration file, for example a `.prettierrc` file."
}Raw JSON Schema
{
"type": "boolean",
"title": "Svelte Format: Bracket New Line",
"default": true,
"description": "Put the `>` of a multiline element on a new line. This option is ignored if there's any kind of configuration file, for example a `.prettierrc` file."
}Raw JSON Schema
{
"type": "boolean",
"title": "Svelte Format: Indent Script And Style",
"default": true,
"description": "Whether or not to indent code inside `<script>` and `<style>` tags. This option is ignored if there's any kind of configuration file, for example a `.prettierrc` file."
}