Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctrl + click on file shown in tab DEBUG OUTPUT with compile error tries to find file with wrong fullpath #456

Closed
scottstensland opened this issue Aug 2, 2020 · 4 comments
Labels
Debug Issues related to the debugging functionality of the extension. FrozenDueToAge HelpWanted Issues that are not prioritized by the maintainers. Help is requested from community contributors. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@scottstensland
Copy link

Issue Type: Bug

a compile error happens to my source file however in DEBUG CONSOLE the offending bad source file is shown with correct fullpath however when I (ctrl + click) on that file error message it tries to goto wrong nonexistent file

however in tabs OUTPUT and PROBLEMS editor behaves OK

Extension version: 0.15.2
VS Code version: Code 1.47.3 (91899dcef7b8110878ea59626991a18c8a6a1b3e, 2020-07-23T15:51:39.791Z)
OS version: Linux x64 5.4.0-42-generic

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz (4 x 3500)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: disabled_software
skia_renderer: disabled_off_ok
video_decode: unavailable_off
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Load (avg) 1, 0, 0
Memory (System) 11.58GB (3.14GB free)
Process Argv --user-data-dir /home/ava/src/stenscode --no-sandbox
Screen Reader no
VM 0%
DESKTOP_SESSION ubuntu
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu
XDG_SESSION_TYPE x11
@scottstensland
Copy link
Author

scottstensland commented Aug 2, 2020

here is editor error on tab DEBUG CONSOLE

vscode_compile_error_shows_wrong_filepath__DEBUG_CONSOLE

notice in above DEBUG CONSOLE shows correct path to source file with compile error

/cryptdata6/var/log/tmp/shared/gopath/src/github.com/scottstensland/linkedlist/pluralsight/functions/control_flow/main.go

              above file exists and fullpath is correct

yet upon doing a ( ctrl + click) on that source file the bottom right popup error message appears which shows it cannot find file while looking in a bad file fullpath

/cryptdata6/var/log/tmp/shared/gopath/src/github.com/scottstensland/linkedlist/main.go

              above file does not exist and fullpath is bad

however when showing tab OUTPUT all is well

vscode_compile_error_shows_wrong_filepath__OUTPUT_tab

@hyangah
Copy link
Contributor

hyangah commented Aug 3, 2020

@scottstensland Do you have a custom launch.json configuration?

Assuming you are using the default launch.json configuration, It looks like since the error message has ./main.go, vscode tries to open the file from the project root directory. That resulted in a wrong file path.

Go Debug Adapter runs the program from the package directory. So, the file paths included in delve's output message need to be replaced with the right ones, in order to teach vscode the right path. Go test output handles the same problem here (

function expandFilePathInOutput(output: string, cwd: string): string {
)

cc @eliben

The execution directory is determined inside the DebugAdapter https://github.com/golang/vscode-go/blob/master/src/debugAdapter/goDebug.ts#L376. Stderr can be inspected and translated here

this.delve.onstderr = (str: string) => {

In DebugAdapter2, it's determined in https://github.com/golang/vscode-go/blob/master/src/debugAdapter2/goDlvDebug.ts#L710.

@hyangah hyangah added Debug Issues related to the debugging functionality of the extension. HelpWanted Issues that are not prioritized by the maintainers. Help is requested from community contributors. NeedsFix The path to resolution is known, but the work has not been done. labels Aug 3, 2020
@scottstensland
Copy link
Author

I launch vscode from the terminal using

code --user-data-dir ~/src/stenscode

and no that dir does not contain any file launch.json

@hyangah hyangah added this to the Backlog milestone Aug 7, 2020
@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/252978 mentions this issue: src/debugAdapter: make filepaths in errors absolute

@hyangah hyangah modified the milestones: Backlog, v0.17.0 Sep 16, 2020
@golang golang locked and limited conversation to collaborators Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Debug Issues related to the debugging functionality of the extension. FrozenDueToAge HelpWanted Issues that are not prioritized by the maintainers. Help is requested from community contributors. NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants