How to fold a set of associated files?
There are some files in a folder, such as
a.proto
a_grpc.pb.go
a_http.pb.go
a_mock.go
b.proto
b_grpc.pb.go
b_http.pb.go
b_mock.go
I would like to place `*_grpc.go *_http.go *_mock.go` under the corresponding `*.proto`.
> a.proto
a_grpc.pb.go
a_http.pb.go
a_mock.go
> b.proto
b_grpc.pb.go
b_http.pb.go
b_mock.go
Similar to the go.sum being placed under go.mod
Please sign in to leave a comment.
This behavior in GoLand can be achieved through file nesting. Here’s how to accomplish this:
1. Open Search Everywhere by clicking on the search icon in the top-right corner
2. Type File Nesting and select it
3. Add a custom nesting rule:
• In the File Nesting section, click on + to add a new rule.
• Define the rule to group the necessary files under the .proto file. For example, to nest a_grpc.pb.go and a_http.pb.go under a.proto, use the rule: a_grpc.pb.go; a_http.pb.go
After saving the rule, go to the Project Window to see the related files nested under their corresponding .proto file. For more details, check the documentation here: https://www.jetbrains.com/help/go/file-nesting-dialog.html
Please let me know if that works for you.
works very well, thank you very much