Unity VS Code integration obscures control over the command line launch arguments in Unity AND it doesn't handle workspaces properly. Instead, its opens the Unity project solution with file:line:column, but this is a different window. This causes problems when dealing with package development. All the package code is outside of the active Unity's project's folder, the only way you can access that code is using a workspace.
This a really foundational feature regression since 2023 deprecation of the old Visual Studio Code Editor package.
Possible Solutions
VS Code Unity Extension Solution
EASIEST SOLUTION
Modify the alert to "Open in Workspace" to carry over the open file:line:column in the workspace.
More Thorough Solution
Detect a single file was opened and that there's an already opened enclosing workspace, seamlessly switch to opening the file in that active workspace.
Visual Studio Editor package Solution
I realize this would be an issue with Visual Studio Editor package in Unity, but it doesn't have a public facing github repo right now.
Allow command line launch arguments like:
--reuse-window --goto "$(File)":$(Line):$(Column)
OR consider launching VSCode via URL with:
vscode://file/{full path to file}:line:column
Steps To Reproduce
Create a Unity project with local "file:../../Packages/com.example.foo" package
Create a VS Code Workspace that includes the Unity project and "../../Packages/com.example.foo" folder.
Open the VS Code Workspace
Create "../../Packages/com.example.foo/Source/foo.cs" that has an error
From Unity, try double clicking on the issue from foo.cs
An easy workaround while we're looking at how we want to support this is to take make the Visual Studio Editor package local to your Unity project and make the modifications you need there.
Describe the Issue
Unity VS Code integration obscures control over the command line launch arguments in Unity AND it doesn't handle workspaces properly. Instead, its opens the Unity project solution with file:line:column, but this is a different window. This causes problems when dealing with package development. All the package code is outside of the active Unity's project's folder, the only way you can access that code is using a workspace.
This a really foundational feature regression since 2023 deprecation of the old Visual Studio Code Editor package.
Possible Solutions
VS Code Unity Extension Solution
EASIEST SOLUTION
Modify the alert to "Open in Workspace" to carry over the open file:line:column in the workspace.
More Thorough Solution
Detect a single file was opened and that there's an already opened enclosing workspace, seamlessly switch to opening the file in that active workspace.
Visual Studio Editor package Solution
I realize this would be an issue with Visual Studio Editor package in Unity, but it doesn't have a public facing github repo right now.
Allow command line launch arguments like:
--reuse-window --goto "$(File)":$(Line):$(Column)
OR consider launching VSCode via URL with:
vscode://file/{full path to file}:line:column
Steps To Reproduce
Expected Behavior
Error should open in the active VS Code Workspace
Environment Information