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.
@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 gopls issue tracker so we can discuss there how to improve this.
changed the title
Feature request: Move methods inside its types in outline viewAug 20, 2020
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.