|
1 | 1 | # Vue (Official) |
2 | 2 |
|
3 | | -## Quick Start |
| 3 | +<p> |
| 4 | + <a href="https://marketplace.visualstudio.com/items?itemName=Vue.volar"><img src="https://img.shields.io/visual-studio-marketplace/v/Vue.volar?labelColor=18181B&color=1584FC" alt="Version"></a> |
| 5 | + <a href="https://marketplace.visualstudio.com/items?itemName=Vue.volar"><img src="https://img.shields.io/visual-studio-marketplace/i/Vue.volar?labelColor=18181B&color=1584FC" alt="Downloads"></a> |
| 6 | +</p> |
| 7 | + |
| 8 | +Vue language support extension for VSCode, providing a full development experience for Vue Single File Components (SFCs). |
| 9 | + |
| 10 | +## Features |
| 11 | + |
| 12 | +- **Syntax Highlighting** - Supports HTML, CSS, JavaScript, TypeScript, Pug, SCSS, Less, etc. in Vue SFCs |
| 13 | +- **Intelligent Completion** - Auto-completion for components, props, events, slots, and directives |
| 14 | +- **Type Checking** - Full TypeScript type inference, including expressions in templates |
| 15 | +- **Error Diagnostics** - Real-time display of Vue compiler errors |
| 16 | +- **Code Navigation** - Go to definition, find references |
| 17 | +- **Refactoring** - Rename, extract component |
| 18 | +- **Formatting** - Format SFCs by block |
| 19 | + |
| 20 | +## Installation |
| 21 | + |
| 22 | +Search for `Vue (Official)` or `Vue.volar` in the VSCode extension marketplace and click install. |
| 23 | + |
| 24 | +## Configuration |
| 25 | + |
| 26 | +### Editor Settings |
| 27 | + |
| 28 | +| Option | Type | Default | Description | |
| 29 | +| :--- | :--- | :--- | :--- | |
| 30 | +| `vue.editor.focusMode` | `boolean` | `false` | Enable focus mode | |
| 31 | +| `vue.editor.reactivityVisualization` | `boolean` | `true` | Show reactivity variable visualization | |
| 32 | +| `vue.editor.templateInterpolationDecorators` | `boolean` | `true` | Show template interpolation decorators | |
| 33 | + |
| 34 | +### Completion Settings |
| 35 | + |
| 36 | +| Option | Type | Default | Description | |
| 37 | +| :--- | :--- | :--- | :--- | |
| 38 | +| `vue.suggest.componentNameCasing` | `string` | `preferPascalCase` | Component name casing style (`preferKebabCase`, `preferPascalCase`, `alwaysKebabCase`, `alwaysPascalCase`) | |
| 39 | +| `vue.suggest.propNameCasing` | `string` | `preferCamelCase` | Prop name casing style (`preferKebabCase`, `preferCamelCase`, `alwaysKebabCase`, `alwaysCamelCase`) | |
| 40 | +| `vue.suggest.defineAssignment` | `boolean` | `true` | Suggest assignments for `defineProps`, etc. | |
| 41 | + |
| 42 | +### Auto-Insert Settings |
| 43 | + |
| 44 | +| Option | Type | Default | Description | |
| 45 | +| :--- | :--- | :--- | :--- | |
| 46 | +| `vue.autoInsert.dotValue` | `boolean` | `false` | Auto-insert `.value` | |
| 47 | +| `vue.autoInsert.bracketSpacing` | `boolean` | `true` | Auto-insert spaces in `{{ }}` | |
| 48 | + |
| 49 | +### Inlay Hints Settings |
| 50 | + |
| 51 | +| Option | Type | Default | Description | |
| 52 | +| :--- | :--- | :--- | :--- | |
| 53 | +| `vue.inlayHints.destructuredProps` | `boolean` | `false` | Show types for destructured props | |
| 54 | +| `vue.inlayHints.inlineHandlerLeading` | `boolean` | `false` | Show parameters for inline handlers | |
| 55 | +| `vue.inlayHints.missingProps` | `boolean` | `false` | Show missing required props | |
| 56 | +| `vue.inlayHints.optionsWrapper` | `boolean` | `false` | Show Options API wrapper | |
| 57 | +| `vue.inlayHints.vBindShorthand` | `boolean` | `false` | Show v-bind shorthand hints | |
| 58 | + |
| 59 | +### Formatting Settings |
| 60 | + |
| 61 | +| Option | Type | Default | Description | |
| 62 | +| :--- | :--- | :--- | :--- | |
| 63 | +| `vue.format.script.enabled` | `boolean` | `true` | Enable script block formatting | |
| 64 | +| `vue.format.template.enabled` | `boolean` | `true` | Enable template block formatting | |
| 65 | +| `vue.format.style.enabled` | `boolean` | `true` | Enable style block formatting | |
| 66 | +| `vue.format.wrapAttributes` | `string` | `auto` | Attribute wrapping style | |
| 67 | + |
| 68 | +### Server Settings |
| 69 | + |
| 70 | +| Option | Type | Default | Description | |
| 71 | +| :--- | :--- | :--- | :--- | |
| 72 | +| `vue.server.path` | `string` | - | Custom language server path | |
| 73 | +| `vue.server.includeLanguages` | `string[]` | `["vue"]` | Language IDs to process | |
| 74 | +| `vue.trace.server` | `string` | `off` | Server trace level | |
| 75 | + |
| 76 | +## Commands |
| 77 | + |
| 78 | +| Command | Description | |
| 79 | +| :--- | :--- | |
| 80 | +| `Vue: Welcome` | Open the welcome page | |
| 81 | +| `Vue: Restart Server` | Restart the language server | |
| 82 | + |
| 83 | +## Using Workspace TypeScript |
| 84 | + |
| 85 | +It is recommended to use the TypeScript version from your project instead of the one built into VSCode: |
| 86 | + |
| 87 | +1. Create `.vscode/settings.json` in your project root |
| 88 | +2. Add the following settings: |
| 89 | + |
| 90 | +```json |
| 91 | +{ |
| 92 | + "typescript.tsdk": "node_modules/typescript/lib", |
| 93 | + "typescript.enablePromptUseWorkspaceTsdk": true |
| 94 | +} |
| 95 | +``` |
| 96 | + |
| 97 | +## Troubleshooting |
| 98 | + |
| 99 | +If you encounter any issues, you can try the following steps: |
4 | 100 |
|
5 | | -- [create-vue](https://github.com/vuejs/create-vue) |
6 | | -- [Vitesse](https://github.com/antfu/vitesse) |
7 | | -- [petite](https://github.com/JessicaSachs/petite) |
8 | | -- [volar-starter](https://github.com/johnsoncodehk/volar-starter) (For bug report and experiment features testing) |
| 101 | +1. **Reload Window**: Run the `Developer: Reload Window` command in VSCode |
| 102 | +2. **Check `vue-tsc`**: Run `npx vue-tsc --noEmit` in the command line to check for type errors |
| 103 | +3. **Check Output Channel**: In VSCode's "Output" panel, select `Vue Language Server` to see if there are any error messages |
9 | 104 |
|
| 105 | +If the problem persists, feel free to open an issue on [GitHub Issues](https://github.com/vuejs/language-tools/issues). |
10 | 106 |
|
11 | | -## ❤️ Thanks to Our Sponsors |
| 107 | +## ❤️ Sponsors |
12 | 108 |
|
13 | | -This project is made possible thanks to our generous sponsors: |
| 109 | +This project's continued development is made possible by our generous sponsors: |
14 | 110 |
|
15 | 111 | <p align="center"> |
16 | | - <a href="https://cdn.jsdelivr.net/gh/johnsoncodehk/sponsors/sponsors.svg"> |
17 | | - <img src="https://cdn.jsdelivr.net/gh/johnsoncodehk/sponsors/sponsors.png"/> |
18 | | - </a> |
| 112 | + <a href="https://cdn.jsdelivr.net/gh/johnsoncodehk/sponsors/sponsors.svg"> |
| 113 | + <img src="https://cdn.jsdelivr.net/gh/johnsoncodehk/sponsors/sponsors.png"/> |
| 114 | + </a> |
19 | 115 | </p> |
20 | 116 |
|
21 | | -## Credits |
| 117 | +## License |
22 | 118 |
|
23 | | -- [vscode-extension-samples](https://github.com/microsoft/vscode-extension-samples) shows all the knowledge required to develop the extension. |
24 | | -- [angular](https://github.com/angular/angular) shows how TS server plugin working with language service. |
25 | | -- Syntax highlight is rewritten base on [vue-syntax-highlight](https://github.com/vuejs/vue-syntax-highlight). |
26 | | -- [vscode-fenced-code-block-grammar-injection-example](https://github.com/mjbvz/vscode-fenced-code-block-grammar-injection-example) shows how to inject vue syntax highlight to markdown. |
| 119 | +[MIT](https://github.com/vuejs/language-tools/blob/master/LICENSE) License |
0 commit comments