BetterErrors / better_errors

Better error page for Rack apps
MIT License
6.88k stars 437 forks source link

Opens New VS Code Welcome Page in New Window #428

Closed richjdsmith closed 3 years ago

richjdsmith commented 6 years ago

I have added the below lines to my .zshrc, but when I click on a link to the source code, it opens a new instance/window of VS Code, and doesn't actually open the file - just the welcome page for VS Code.

export PATH="\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
export EDITOR="code"

Any suggestions? Is this just me or a common problem? If so, I'll dig around and try and submit a PR.

RobinDaugherty commented 6 years ago

What OS are you using? Which browser and which version of VSCode?

I can confirm that it works on macOS 10.13.6, Safari and Chrome 68, and VSCode 1.27.2.

richjdsmith commented 5 years ago

macOS 10.12.6, Firefox 64, and VSCode 1.28.2

RobinDaugherty commented 5 years ago

Sorry for the delayed response.

Did you follow the instructions to install the Shell Command? You should not modify your PATH, VSCode will place the shell command /usr/local/bin/code which should already be in your PATH. If you have a previous version of the Shell Command installed, it will be earlier in your PATH and will therefore take precedence over the one in the VSCode app bundle that you place in the PATH.

I can confirm that with macOS 10.14.1, Firefox 63.0.3 (the current release), and VSCode 1.29.1, the correct line and file are opened using the link, in the existing project window.

andrewcupper commented 5 years ago

I got this to work with VS code by editing config/initializers/better_errors.rb as follows:

if defined?(BetterErrors)
   BetterErrors.editor = proc { |file, line| 'vscode://file%{file}:%{line}' % { file: file, line: line } }
end