• Stars
    star
    253
  • Rank 159,903 (Top 4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 3 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Volar (Fast Vue Language Support) extension for coc.nvim

coc-volar

fork from a vscode-vue

Vue Language Features (Volar) extension for coc.nvim coc-volar-demo

Install

:CocInstall @yaegassy/coc-volar

scoped packages

(Optional) Additional installation of coc-extension

If you want to use volar.action.splitEditors, volar.action.vite, volar.action.nuxt and other feature, please install coc-volar-tools.

:CocInstall @yaegassy/coc-volar-tools

scoped packages

[IMPORTANT] Enable "Take Over Mode"

In coc-volar, please enable and use "Take Over Mode". Check the Vue.js documentation for more information on "Take Over Mode".

If you want to use the "TypeScript Vue Plugin" instead of Take Over Mode, install typescript-vue-plugin in your project (npm install typescript-vue-plugin). After installation, add a setting in tsconfig.json to use typescript-vue-plugin.

If you are using "Take Over Mode" for the first time in your project

  1. To begin, open the *.vue, *.ts, *.js, *.tsx, *.jsx file.
  2. Then run :CocCommand volar.initializeTakeOverMode.
  3. When prompted by Enable Take Over Mode? (y/n)?, enter y
  4. The .vim/coc-settings.json file will be created in the "project root".
    • The "volar.takeOverMode.enabled": true and "tsserver.enable": false settings will be added.
  5. coc.nvim will be restarted and the settings will be reflected.

If you want to disable Take Over Mode for a project

Delete the .vim/coc-settings.json file in the "project root", and start Vim again.

VitePress and petite-vue support

Notes for make VitePress, petite-vue project working with Volar.

VitePress

  • Set vue.server.vitePress.supportMdFile to true in .vim/coc-settings.json.
    • [WARNING] If you use this setting, it is recommended to enable it at the workspace (project) level.
  • vue is optional add in devDependencies for better intellisense.
  • Make sure added related .md files path to tsconfig.json include property.

petite-vue

  • Set vue.server.petiteVue.supportHtmlFile to true in .vim/coc-settings.json.
    • [WARNING] If you use this setting, it is recommended to enable it at the workspace (project) level.
  • Set html.enable to false in .vim/coc-settings.json.
  • vue is optional add in devDependencies for better intellisense.
  • Make sure added related .html files path to tsconfig.json include property.

[RECOMMENDED] Additional installation of "watchman"

In the @vue/language-server used by coc-volar, it utilizes the workspace/didChangeWatchedFiles notification to watch files within the project.

In coc.nvim, it is recommended to install watchman in order to utilize this feature.

If you have difficulty installing watchman, you can use coc-volar without watchman, but you may not be able to immediately use volar's IntelliSense with the newly added files.

In this case, please execute the command to restart the language server.

  • :CocRestart

workspaceFolders

Depending on the project like mono repo or how Vim/Neovim is started, workspaceFolders may not be recognized correctly.

If workspaceFolders are not recognized correctly, the language server may parse unnecessary project folders, etc., slowing down the operation. Or Language Server may not work properly.

The default configuration of coc.nvim resolves to the directory where the .git, .hg, or .projections.json files reside as the workspace root.

coc-volar has also already added vite.config.ts, vite.config.js, vue.config.js or nuxt.config.ts to the extension side to resolve workspace root.

If further customization is needed, set b:coc_root_patterns in ".vimrc/init.vim".

Example:

  au FileType vue let b:coc_root_patterns = ['.git', '.env', 'package.json', 'tsconfig.json', 'jsconfig.json', 'vite.config.ts', 'vite.config.js', 'vue.config.js', 'nuxt.config.ts']

For more information, check this coc.nvim's wiki.

iskeyword

If the completion menu disappears when typing -, add the iskeyword setting to .vimrc / init.vim.

autocmd Filetype vue setlocal iskeyword+=-

Configuration options

  • volar.enable: Enable coc-volar extension, default: true
  • volar.useWorkspaceTsdk: Use workspace (project) detected tsLibs in volar. if false, use coc-volar's built-in tsLibs, default: false
  • volar.tsLocale: Sets the locale used to report diagnostics message from typescript, valid option: ["cs", "de", "es", "fr", "it", "ja", "ko", "en", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"], default: "en"
  • volar.autoCreateQuotes: Enable/disable auto creation of quotes for HTML attribute assignment, default: false
  • volar.autoClosingTags: Enable/disable autoClosing of HTML tags, default: false
  • volar.scaffoldSnippets.enable: Enable/disable scaffold snippets completion. Typing vue or vuedc will output completion suggestions. This snippets completion feature will only work on the first line of the file, default: true
  • volar.disableDiagnostics: Disable diagnostics from Volar, default: false
  • volar.disableFormatting: Disable formatting from Volar, default: false
  • volar.disableProgressNotifications: Disable the initialization and workdone progress notifications, default: false
  • volar.dev.serverPath: (For develop and check) Custom path to volar server module, ~ and $HOME, etc. can also be used. If there is no setting, the built-in module will be used, default: ""
  • volar.takeOverMode.enabled: Take over language support for *.ts, default: false
  • volar.format.initialIndent: Whether to have initial indent, default: {}
  • vue-semantic-server.trace.server: Traces the communication between coc.nvim and the language server, valid option: ["off", "messages", "verbose"], default: "off"
  • vue-syntactic-server.trace.server: Traces the communication between coc.nvim and the language server, valid option: ["off", "messages", "verbose"], default: "off"
  • vue.server.configFilePath: Path to volar.config.js, default: ./volar.config.js
  • vue.server.maxFileSize: Maximum file size for Vue Server to load. (default: 20MB), default: 20971520
  • vue.server.petiteVue.supportHtmlFile : Recognize .html extension as PetiteVue file format. If you use this setting, it is recommended to enable it at the workspace (project) level. You must also place tsconfig.json or jsconfig.json in your project, and adding __PATH_TO_HTML_FILES_/*.html to config include option, default: false
  • vue.server.vitePress.supportMdFile: Recognize .md extension as VitePress file format. If you use this setting, it is recommended to enable it at the workspace (project) level. You must also place tsconfig.json or jsconfig.json in your project, and adding __PATH_TO_MD_FILES_/*.md to config include option, default: false
  • vue.server.diagnosticModel: Diagnostic update model, valid option: ["push", "pull"], default: push
  • vue.server.maxOldSpaceSize: Set --max-old-space-size option on server process. Maximum memory (in MB) that the server should use. On some systems this may only have effect when runtime has been set. Minimum 256.
  • vue.server.reverseConfigFilePriority: Reverse priority for tsconfig pickup, default: false
  • vue.server.additionalExtensions: List any additional file extensions that should be processed as Vue files (requires restart), default: []
  • vue.server.fullCompletionList: Enable this option if you want to get complete CompletionList in language client. (Disable for better performance), default: false
  • vue.codeActions.enabled: Enabled code actions, default: true
  • vue.codeLens.enabled: Enabled code lens, default: true
  • vue.complete.casing.tags: Preferred tag name case, valid options: ["autoKebab", "autoPascal", "kebab", "pascal"], default: "autoPascal"
  • vue.complete.casing.props: Preferred attr name case, valid options: ["autoKebab", "autoCamel", "kebab", "camel"], default: "autoKebab"
  • vue.complete.normalizeComponentImportName: Normalize import name for auto import. ("myCompVue" -> "MyComp"), default: true
  • vue.autoInsert.parentheses: Auto-wrap () to As Expression in interpolations for fix volar-issue #520, default: true
  • vue.autoInsert.dotValue: Auto-complete Ref value with .value, default: false
  • vue.autoInsert.bracketSpacing: Auto add space between double curly brackets: {{|}} -> {{ | }}, default: true
  • vue.inlayHints.missingProps: Show inlay hints for missing required props, false
  • vue.inlayHints.inlineHandlerLeading: Show inlay hints for event argument in inline handlers, default: false
  • vue.inlayHints.optionsWrapper: Show inlay hints for component options wrapper for type support, default: false

Commands

  • volar.initializeTakeOverMode: Enable Take Over Mode in your project
  • volar.action.doctor: Show Doctor info
  • volar.action.restartServer: Restart Vue server
  • volar.action.reloadProject: Reload Project
  • volar.action.showComponentMeta: Show Component Meta
  • volar.action.splitEditors: Split <script>, <template>, <style> Editors
  • volar.action.vite: Experimental Features for Vite
  • volar.action.nuxt: Experimental Features for Nuxt
  • volar.vue.findAllFileReferences: Vue: Find File References

More features

Other major LSP feature are of course supported as well.

completion, definition, typeDefinition, diagnostics, hover, signatureHelp, references, codeLens, formatting, rename and more...

Thanks

License

MIT


This extension is built with create-coc-extension

More Repositories

1

coc-tailwindcss3

Intelligent Tailwind CSS tooling for coc.nvim
TypeScript
175
star
2

coc-intelephense

intelephense (PHP language server) extension for coc.nvim. intelephense’s various LSP features and this extension's additional features are available.
TypeScript
89
star
3

coc-ansible

ansible-language-server extension for coc.nvim
TypeScript
67
star
4

coc-ruff

ruff-lsp (ruff) extension for coc.nvim
TypeScript
48
star
5

coc-blade

Laravel Blade Templates extension for coc.nvim. Provides "formatter", "linter", "completion" and more...
TypeScript
44
star
6

coc-html-css-support

HTML id and class attribute "completion" for coc.nvim.
TypeScript
42
star
7

coc-htmldjango

django templates (htmldjango) extension for coc.nvim. Provides "formatter", "linter", "completion" and more...
TypeScript
34
star
8

coc-pydocstring

doq (python docstring generator) extension for coc.nvim
TypeScript
32
star
9

coc-pylsp

pylsp (python-lsp-server) extension for coc.nvim.
TypeScript
31
star
10

coc-php-cs-fixer

PHP CS Fixer (PHP Coding Standards Fixer) and Laravel Pint extension for coc.nvim
TypeScript
31
star
11

coc-nginx

nginx-language-server extension for coc.nvim
TypeScript
29
star
12

coc-sqlfluff

SQLFluff (A SQL linter and auto-formatter for Humans) extension for coc.nvim
TypeScript
29
star
13

coc-marksman

Marksman (Markdown LSP server) extension for coc.nvim
TypeScript
28
star
14

coc-astro

Astro extension for coc.nvim
TypeScript
23
star
15

coc-laravel

Laravel extension for coc.nvim
TypeScript
22
star
16

coc-volar-tools

Additional features of coc-volar
TypeScript
16
star
17

coc-psalm

coc.nvim extension for "Psalm" language server
TypeScript
13
star
18

coc-htmlhint

Integrates the HTMLHint static analysis tool into coc.nvim.
TypeScript
13
star
19

coc-phpstan

PHPStan (PHP Static Analysis tool) extension for coc.nvim
TypeScript
13
star
20

coc-vitest

Vitest for coc.nvim
TypeScript
12
star
21

coc-ast-grep

coc.nvim extension for ast-grep language server
TypeScript
11
star
22

coc-jsdoc

lehre (jsdoc/esdoc/tsdoc document block generator) extension for coc.nvim
TypeScript
11
star
23

coc-esbonio

esbonio ([Sphinx] Python Documentation Generator) language server extension for coc.nvim
TypeScript
11
star
24

coc-graphql

GraphQL extension for coc.nvim
TypeScript
8
star
25

coc-typeprof

Ruby TypeProf extension for coc.nvim
TypeScript
8
star
26

coc-volar-alpinejs

Alpine.js Language Features (Volar) extension for coc.nvim
TypeScript
8
star
27

coc-mypy

microsoft/vscode-mypy's langauge server extension for coc.nvim
TypeScript
8
star
28

coc-pysen

pysen-ls (pysen language server) extension for coc.nvim. Python linting, formatting made easy.
TypeScript
7
star
29

coc-pug

Pug Language Features for coc.nvim
TypeScript
6
star
30

coc-blade-formatter

blade-formatter (Laravel Blade formatter) extension for coc.nvim
TypeScript
6
star
31

coc-pyright-tools

coc-pyright-tools is a coc-extension that adds its own functionality to coc-pyright for coc.nvim. Currently the "Inlay Hints", "CodeLens" and "Test Framework commands" feature is available.
TypeScript
6
star
32

coc-typescript-vue-plugin

TypeScript Vue Plugin (Volar) for coc.nvim
JavaScript
6
star
33

sqlfluff-language-server

[Expelmental] A sql language server exclusively for sqlfluff and coc.nvim extension
Python
4
star
34

coc-cucumber

Cucumber extension for coc.nvim
JavaScript
4
star
35

coc-black-formatter

microsoft/vscode-black-formatter's langauge server extension for coc.nvim
TypeScript
4
star
36

coc-blade-linter

Laravel Blade Linter extension for coc.nvim, Performs syntax-checks of your Blade templates. Just that.
TypeScript
3
star
37

coc-tighten-lint

tlint (Tighten linter for Laravel) extension for coc.nvim
TypeScript
3
star
38

toml-lint

A linter for TOML files that can detect multiple errors using by tree-sitter parser
Python
3
star
39

fann-sql-language-server

[Expelmental and Study] Implemented fannheyward/coc-sql features in the language server.
TypeScript
3
star
40

mypy-json-schema

This is the JSON schema for "mypy" ([tool.mypy]) specifically designed for the pyproject.toml file.
HTML
2
star
41

coc-ruby-syntax-tree

coc.nvim support for the syntax_tree gem
TypeScript
1
star
42

coc-curlylint

curlylint extension for coc.nvim, Curlylint is an HTML linter for "curly braces" templates, and their HTML.
TypeScript
1
star