-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/tools/gopls: consider moving methods inside its type in outline view #40931
Comments
@emil14 Are you using the language server? ( I am asking because the extension computes the outline info in two different ways, so I need to know it to direct this FR to the right place. |
This is conceptually difficult: in Go, a method can be defined in a different file than the declaration. In that case, there is no struct node to put it under. In gopls, we decided to leave methods at the top level. |
@hyangah yes, useLanguageServer set to true :) |
@emil14 Thanks! Yeah, I observed that when not using the language server, the outline view grouped methods under its struct type. As @heschik said, Go's code structure is different from other languages, so the document-based symbol hierarchy (DocumentSymbolProvider and its corresponding LSP method) doesn't fit perfectly. I will transfer this to |
Thanks for the feature request, @emil14. For now, our approach to the outline view has been to show symbols in the order that they appear in the file. This would require us to change that behavior. Before moving forward with this, I'd like to hear from other users if they think this would be a net improvement. Notably, we can't show the methods nested within the type declaration because that breaks VS Code's breadcrumbs feature. |
It would be nice if we could look at some type in outline view and see all of the methods declared on that type in one place.
At the moment type and its methods separated
The text was updated successfully, but these errors were encountered: