-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
VSCode: Function Names not Visible in the Call Stack View #3323
Comments
Response from a VSCode maintainer:
Not sure, but I assume this would refer to here... |
We could reorganize the information to make sure that the critical information (including the function name), is going to appear in a reasonable distance from the start of the string. We could do this by moving the qualified package name after the function name for long packages. I think for ease of reading, package names should be kept before the function name. A couple of examples for this idea are below:
This would keep the names similarly long, but would prioritize having the function name appear before a potentially very long package path. The package path could also be dropped completely, though this does remove some information, and there is not a clear way in DAP to add this additional information to a stack frame (can't provide longer description to be displayed in hover), so I would be inclined to reorder for now. Note: first stack frame should be |
Thanks @suzmue for exploring the options. I noticed the DAP spec has VS Code shows a tooltip when hovering over a stack frame. I wonder if we can ask vscode team to present a long name in the tooltip while showing a short name in the stackframe ui. |
Related issue in vscode-go issue tracker golang/vscode-go#2707 |
This feature is not yet available in VS Code AFAICT (see microsoft/vscode#148125 and microsoft/vscode#28025 (comment)). The workaround recommended for the variable use case is to add a context menu item that could trigger a custom request and then use an invalidate event to refresh the view (see microsoft/vscode#28025 (comment)). |
I experimented with the simple approach of reordering function name and package name to see how hard it would be, and it seems that this little patch does it: diff --git a/service/dap/server.go b/service/dap/server.go
index 5bb38f1b..f129c6f3 100644
--- a/service/dap/server.go
+++ b/service/dap/server.go
@@ -1684,7 +1684,11 @@ func fnName(loc *proc.Location) string {
if loc.Fn == nil {
return "???"
}
- return loc.Fn.Name
+ name := loc.Fn.Name
+ if idx := strings.LastIndex(name, "/"); idx != -1 {
+ return fmt.Sprintf("%s (in %s)", name[idx+1:], name[:idx])
+ }
+ return name
}
func fnPackageName(loc *proc.Location) string { I wonder if I'm missing something (I'm still kind of new to go), but if this is how it would be done, then I'd appreciate some guidance what's missing to turn this into a PR. In particular, I have no idea what to do to However, I also have to say that I find the output still too noisy with the added package paths, and personally I would prefer to omit them, i.e. diff --git a/service/dap/server.go b/service/dap/server.go
index 5bb38f1b..97c5abf6 100644
--- a/service/dap/server.go
+++ b/service/dap/server.go
@@ -1684,7 +1684,11 @@ func fnName(loc *proc.Location) string {
if loc.Fn == nil {
return "???"
}
- return loc.Fn.Name
+ name := loc.Fn.Name
+ if idx := strings.LastIndex(name, "/"); idx != -1 {
+ return name[idx+1:]
+ }
+ return name
}
func fnPackageName(loc *proc.Location) string { I wonder if this would need a config option. Either way, this is such a dramatic improvement to usability that I'd like to make some progress on this. |
I went ahead and made a PR (#3497), including the option to strip the paths entirely. First-time contribution, please be gentle! 😉 |
Thanks @stefanhaller I hoped to surface the package path info using a different UI element (microsoft/vscode#193153) instead of introducing another setting or configuration param, but it sounds like we need to go the whole nine yards in both VS Code and Delve :-( The more I think, the more I like the idea of hiding the package path from the stack frame. When VS Code and other DAP clients are ready, we can adopt their new feature to supply the package path. Is there any case where showing the full package path is preferable? |
I'd be more than happy to strip the package path unconditionally; I only provided the Do you think we can do this already now, even when we can't provide the tooltip yet? I'd very much hope so, it's a dramatic usability improvement, as I said already. I have been using a locally patched dlv for a week or so now, the difference is night and day. |
I agree that shorter frame name is much better! If my proposal to extend the DAP microsoft/debug-adapter-protocol#433 is accepted, we can also add the full name as a longer description. Implementation-wise I think that's relatively easy. |
Great. Instead of changing the existing PR, I decided to open a new one: #3500. The implementation is much simpler, of course. |
Originally reported as microsoft/vscode#178964 but redirected here.
dlv version
)?1.20.1
go version
)?go1.20.2
gopls
project into VSCodeTestLSP
testThis video shows how wide I have to make the Call Stack View to see the relevant parts of the stack trace rows.
wide-or-unreadable-call-stack.mov
The text was updated successfully, but these errors were encountered: