You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update vuejs-tutorial.md
Updated outdated information and improved readability for clarity and accuracy.
* Add missing bracket
* update old screenshots
* trying to fix images
Copy file name to clipboardExpand all lines: docs/nodejs/vuejs-tutorial.md
+20-11Lines changed: 20 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,9 @@ MetaDescription: Vue JavaScript tutorial showing IntelliSense, debugging, and co
9
9
---
10
10
# Using Vue in Visual Studio Code
11
11
12
-
[Vue.js](https://vuejs.org/) is a popular JavaScript library for building web application user interfaces and Visual Studio Code has built-in support for the Vue.js building blocks of [HTML](/docs/languages/html.md), [CSS](/docs/languages/css.md), and [JavaScript](/docs/languages/javascript.md). For a richer Vue.js development environment, you can install the [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)and [Volar for TypeScript](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) extensions that support Vue.js IntelliSense, code snippets, formatting, and more.
12
+
[Vue.js](https://vuejs.org/) is a popular JavaScript library for building web applications and user interfaces, and Visual Studio Code has built-in support for the Vue.js building blocks of [HTML](/docs/languages/html.md), [CSS](/docs/languages/css.md), and [JavaScript](/docs/languages/javascript.md). For a richer Vue.js development environment, you can install the [Vue - Official (previously Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.volar)extension to have support for IntelliSense, [TypeScript](/docs/languages/typescript), formatting, and more.
13
13
14
-
>**Note**: [Vue 2 support will end on December 31st, 2023](https://v2.vuejs.org/lts/) so the use of the [Vetur](https://marketplace.visualstudio.com/items?itemName=octref.vetur) extension is [not recommended](https://github.com/vuejs/vetur/discussions/3378). You will need to [disable Vetur](https://vuejs.org/guide/typescript/overview.html#ide-support) to use Volar.
14
+
>**Note**: [Vue 2 support ended on December 31st, 2023](https://v2.vuejs.org/lts/), so the use of the [Vetur](https://marketplace.visualstudio.com/items?itemName=octref.vetur) extension is [not recommended](https://github.com/vuejs/vetur/discussions/3378). You will need to [disable Vetur](https://vuejs.org/guide/typescript/overview.html#ide-support) to use the Vue - Official extension.
15
15
16
16
---
17
17
@@ -54,7 +54,7 @@ Let's quickly run our Vue application by typing `npm run dev` to start the web s
54
54
npm run dev
55
55
```
56
56
57
-
You should see "Welcome to your Vue.js App" on [http://localhost:5173](http://localhost:5173) in your browser. You can press `kbstyle(Ctrl+C)` to stop the `vue-cli-service` server.
57
+
You should see "Welcome to your Vue.js App" on [http://localhost:5173](http://localhost:5173) in your browser.
58
58
59
59
To open your Vue application in VS Code, from a terminal (or command prompt), navigate to the `vue-project` folder and type `code .`:
60
60
@@ -69,9 +69,9 @@ VS Code will launch and display your Vue application in the File Explorer.
69
69
70
70
Now expand the `src` folder and select the `App.vue` file. You'll notice that VS Code doesn't show any syntax highlighting and it treats the file as **Plain Text** as you can see in the lower right Status Bar. You'll also see a notification recommending the [Vue - Official](https://marketplace.visualstudio.com/items?itemName=Vue.volar) extension for the `.vue` file type.
71
71
72
-
The Vue extension supplies Vue.js language features (syntax highlighting, IntelliSense, snippets, formatting) to VS Code.
72
+
The Vue extension supplies Vue.js language features (syntax highlighting, IntelliSense, and formatting) to VS Code.

75
75
76
76
From the notification, press **Install** to download and install the Vue extension. You should see the Vue extension **Installing** in the Extensions view. Once the installation is complete (may take several minutes), the **Install** button changes to the **Manage** gear button.
77
77
@@ -91,15 +91,23 @@ and Vue properties such as `computed` in the `scripts` section:
91
91
92
92
### Go to Definition, Peek definition
93
93
94
-
VS Code through the Volar extension Vue.js language service can also provide type definition information in the editor through **Go to Definition** (`kb(editor.action.revealDefinition)`) or **Peek Definition** (`kb(editor.action.peekDefinition)`). Put the cursor over the `App`, right-click and select **Peek Definition**. A [Peek window](/docs/editor/editingevolved.md#peek) opens showing the `App` definition from `App.js`.
94
+
The Vue - Official extension in VS Code enhances the Vue.js development experience by providing language service features such as type definitions. You can access these features using:
95
+
96
+
-**Go to Definition** (`kb(editor.action.revealDefinition)`): Navigate directly to the type definition in your code.
97
+
-**Peek Definition** (`kb(editor.action.peekDefinition)`): View the type definition inline without leaving your current context.
98
+
99
+
To use Peek Definition, follow these steps:
100
+
1. Place the cursor over `App`.
101
+
2. Right-click, hover over **Peek** in the context menu, and select **Peek Definition**.
102
+
3. A [Peek window](/docs/editor/editingevolved.md#peek) will open, displaying the `App` definition from `App.js`.
Let's update the sample application to "Hello World!". In `App.vue` replace the HelloWorld component `msg` custom attribute text with "Hello World!".
110
+
Let's update the sample application to render "Hello World!". In `App.vue` replace the HelloWorld component `msg` custom attribute text with "Hello World!".
103
111
104
112
```html
105
113
<template>
@@ -117,7 +125,8 @@ Let's update the sample application to "Hello World!". In `App.vue` replace the
117
125
</template>
118
126
```
119
127
120
-
Once you save the `App.vue` file (`kb(workbench.action.files.save)`), restart the server with `npm run dev` and you'll see "Hello World!". Leave the server running while we go on to learn about Vue.js client side debugging.
128
+
Once you save the `App.vue` file (`kb(workbench.action.files.save)`), Vite's [Hot Module Replacement (HMR)](https://vite.dev/guide/features.html#hot-module-replacement) feature will instantly reflect the updates in the browser, and you'll see "Hello World!". Keep the server running as we move on to learn about Vue.js client-side debugging.
129
+
121
130
122
131
>**Tip**: VS Code supports Auto Save, which by default saves your files after a delay. Check the **Auto Save** option in the **File** menu to turn on Auto Save or directly configure the `files.autoSave` user [setting](/docs/getstarted/settings.md).
123
132
@@ -129,7 +138,7 @@ Once you save the `App.vue` file (`kb(workbench.action.files.save)`), restart th
129
138
130
139
## Linting
131
140
132
-
Linters analyze your source code and can warn you about potential problems before you run your application. The Vue ESLint plugin ([eslint-plugin-vue](https://www.npmjs.com/package/eslint-plugin-vue)) checks for Vue.js specific syntax errors, which are shown in the editor as red squiggles and are also displayed in the **Problems** panel (**View** > **Problems**`kb(workbench.actions.view.problems)`).
141
+
Linters analyze your source code and can warn you about potential problems before you run your application. The Vue ESLint plugin ([eslint-plugin-vue](https://eslint.vuejs.org/)) checks for Vue.js specific syntax errors, which are shown in the editor as red squiggles and are also displayed in the **Problems** panel (**View** > **Problems**`kb(workbench.actions.view.problems)`).
133
142
134
143
Below you can see an error when the Vue linter detects more than one root element in a template:
135
144
@@ -141,11 +150,11 @@ You can debug client side Vue.js code with the built-in JavaScript debugger. Fol
141
150
142
151
For Vue CLI, which is [now in maintenance mode](https://vuejs.org/guide/scaling-up/tooling#vue-cli), check out [Vue.js debugging in VS Code](https://github.com/microsoft/vscode-recipes/tree/main/vuejs-cli) recipe on the VS Code debugging [recipes](https://github.com/microsoft/vscode-recipes) site to learn more.
143
152
144
-
Another popular tool for debugging Vue.js is the [vue-devtools](https://github.com/vuejs/vue-devtools) plug-in, which can be used regardless of the environment.
153
+
Another popular tool for debugging Vue.js is the [vue-devtools](https://devtools.vuejs.org/) plug-in, which can be used regardless of the environment.
145
154
146
155
## Other extensions
147
156
148
-
Volar is only one of many Vue.js extensions available for VS Code. Another recommended extension is [Volar for TypeScript](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
157
+
[Vue - Official extention](https://vueschool.io/lessons/volar-the-official-language-feature-extension-for-vs-code)is only one of many Vue.js extensions available for VS Code.
0 commit comments