Enumeration warning in VS Code debug console #14665
Replies: 4 comments 1 reply
-
|
@awa5114 That warning is expected behavior in Vue 3 and not a problem with your code. What’s happening is that when you type Why you only see it in VS Code
How to handle it
Bottom lineYour application is fine. The warning is only a side effect of how VS Code inspects Vue instances during debugging. It doesn’t affect runtime behavior, and you can safely ignore it or avoid typing |
Beta Was this translation helpful? Give feedback.
-
|
@awa5114 The confusion here is really about how Vue’s warning gets triggered. When you type What I mean by “directly access” is: don’t stop at For example: // This triggers the warning:
this.
// This does not:
this.x
// Also fine:
this.runMethod()So if you want to see the value of The key takeaway is:
If your workflow is to type |
Beta Was this translation helpful? Give feedback.
-
|
In order to type |
Beta Was this translation helpful? Give feedback.
-
|
@awa5114 Right, I see what you mean — the warning fires the moment you type the period, before you even get to finish writing Unfortunately, there’s no way around that behavior inside the VS Code console itself — it’s not Vue being picky, it’s the debugger’s inspection mechanism. That’s why Chrome DevTools doesn’t show the warning: it doesn’t enumerate in the same way when you type The practical workarounds are:
So bottom line: the warning is unavoidable in VS Code the moment you type |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a minimal Vue 3 application created using
npm create vue@latest. The application contains a simpleApp.vuefile with the following contents:I perform the following steps:
this.in the vs code debug consoleThe following warning appears:
This warning only appears in the vs code debug console during debugging. I have checked in the chrome developer tools and the warning never appears.
Here is the VS Code launch configuration:
{ "name": "VUE", "type": "chrome", "request": "launch", "url": "http://localhost:5173", "cwd": "${workspaceFolder}", "webRoot": "${workspaceFolder}", "preLaunchTask": "npm: dev - frontend", "runtimeArgs": [ "--incognito" ], }The launch task is as follows:
{ "label": "npm: dev - frontend", "type": "npm", "script": "dev", "path": "", "isBackground": true, "problemMatcher": { "pattern": [ { "regexp": ".", "file": 1, "message": 0, "kind": "file" } ], "background": { "activeOnStart": true, "beginsPattern": "vite v", "endsPattern": "help" } } }The warning is very annoying and interferes with everything I do in the debug console.
Beta Was this translation helpful? Give feedback.
All reactions