Bug: VSC go to definition doesn't open workspace
Version
v2.16.0.alpha
What happened?
When using the new "Go to Definition" feature with VSC selected, upon opening the file it is opened without opening the rest of the environment folder. This means that anything defined outside of the selected file is not defined when viewing it from this feature, unless the folder is already opened.
I believe this can be fixed by using code environmentpath -g filepath, though I'm not able to PR a fix because I'm unable to download the project's dependencies currently.
Here's what a fix might look like in internal\app\ui\cpenvironment\menu.go:61 (Though this may be completely wrong since I've not programmed in Go before)
case prefs.CodeEditorVSC:
root := filepath.FromSlash(e.app.LoadedEnvironment().RootDir)
argument := path + ":" + fmt.Sprint(location.Line) + ":" + fmt.Sprint(location.Column)
command = exec.Command(prefs.CodeEditorVSCActual, root, "-g", argument)
Otherwise, this can be avoided by having the correct folder already open in VSC.
Reproduction
- Run StrongDMM
- Open an environment
- Use the new "Go to Definition" feature on any atom, with VSC selected as the "Code Editor" preference
- File opens, but the proper environment isn't loaded, causing errors if the environment isn't already opened
Relevant log output
2025-05-07 19:33:58 DBG sdmm/internal/app/ui/cpenvironment/menu.go:54 > do go to definition:/area