dotBunny/VSCode

Double clicking unity exception no longer opens script at error line

Closed this issue · 7 comments

I've noticed recently double clicking an exception no longer opens the offending script at all.
It works fine if I switch back to mono develop. The script is opened at the offending line.

With VS code integration enabled nothing happens.
Assets -> Open C# project in VSCode opens correctly.
Double clicking script in Project window opens the script fine.

Windows 10
Unity 5.3.6
VS Code 1.5.3
VS Code unity plugin 2.70-release

Can confirm, I have the same issue.
Windows 10
Unity 5.3.6p6 and 5.4.1f1
VS Code 1.5.3
VS Code unity plugin 2.70-release

I'm also having the same issue. It might have started happening after updating VSCode to version 1.5 (not completely sure).

UPDATE: It's a VSCode bug that makes absolute paths fail because of the : in C:/ being counted as the : that separates the file from the line of code to open. It's referenced here and here. The insiders build fixes the bug, but I haven't tried it because it has a different install path and everything.

In the command line I'm able to circumvent the bug by calling VSCode like this:
"C:\Program Files (x86)\Microsoft VS Code\bin\code.cmd" "../../../Users/user/UnityProject" -g "../../../Users/user/UnityProject\Assets/Plugins/Editor/VSCode.cs:941" -r

But for some reason, changing the plugin's code so that the process is called with "C:\Program Files (x86)\Microsoft VS Code\bin\code.cmd" and the arguments as "../../../Users/user/UnityProject" -g "../../../Users/user/UnityProject\Assets/Plugins/Editor/VSCode.cs:941" -r doesn't work

UPDATE2: Apparently it needed the working directory too... proc.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(CodePath);. Anyway, I made it work for Debug.Logs, but clicking on exceptions is still ignored, so nevermind. Better to update to the insider build or wait for the next stable VSCode build.

So what is the recommendation ? Leave VSCode plugin as is ... and hope that the MS team fixes on their end? --- ie wait and have people complain a little while longer :)

Hmm... Maybe use omid3098's version of the file until the next stable VSCode version...? I think I'll be doing that. The fix seems to work nicely, which mine didn't. :)

By the way, thanks @omid3098! (if you see this)

Makes sense, people use it till the next stable ... i would merge all the spacing changed ;|

You're welcome and sorry about spacing changes! auto format done with vscode!
nothing has changed in code except breaking file absolute path.
Project path goes to process and remaining relative path goes to vscode file path.

Seems like it's fixed in the latest Insider build, good spot!
Not the fault of this plugin so closing.