webfansplz / vite-plugin-vue-inspector

jump to editor source code while click the element of browser automatically.
MIT License
697 stars 74 forks source link

Can't use the "Open in editor" feature. #88

Closed DerDemystifier closed 7 months ago

DerDemystifier commented 7 months ago

I'm using the VueDevTools plugin, but I figured the problem might be related to the inspector instead.

The problem is that "Open in editor" doesn't do anything but show this error message in the logs:

  vite:time 1772.16ms /?file=src%2Fcomponents%2Fchatbox%2Fchat-window.vue%3A34%3A5 +1m
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Could not open chat-window.vue in the editor.
The editor process exited with an error: (code 1).

From the looks of it. The plugin tries to open the chat-window.vue component but there's a syntax error in the shell command. It seems like it's attempting to reference something in C:\Program Files\ but I don't know what's C:\Program Files\ got to do with this in the first place since VSCode is in %AppData%.

EDIT: I have noticed something. This error ↑ only shows up if I have Notepad++ opened in the background. If Notepad++ is opened: Error 'C:\Program' is not recognized as an internal or external command, If Notepad++ and Code are closed: Opens the file with MS-Notepad without problem. If Notepad++ is closed and Code is open: Error C:\Users\bassi\AppData\Local\Programs\Microsoft' is not recognized as an internal or external command,

DerDemystifier commented 7 months ago

Finally, I was able to workaround this issue. Credit to https://github.com/sveltejs/vite-plugin-svelte/issues/608#issuecomment-1480851467

Here's what I did in case someone finds himself in this issue:

  1. Create a .bat file and put it somewhere that doesn't have spaces in the path. Then paste this in the .bat file:

    @ECHO OFF
    set filename=%1
    set lineNumber=%2
    set columnNumber=%3
    "%LocalAppData%\Programs\Microsoft VS Code\Code.exe" -r -g %filename%:%lineNumber%:%columnNumber%
  2. Then go to you PATH variables and add this variable with the value being the .bat file: image

  3. Restart VS Code or cmd (or whatever you use to run dev your project).