Sharing one of my favorite "scopes" in intellij, and making it easier to add more #1182
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goland is nice, and the type-based navigation is wildly superior to gopls-driven
stuff in my experience, so I tend to lean hard on it when I'm able.
By default though, Goland searches everything. All the time.
That's totally reasonable as a default, but we can do better:
(perhaps they should be, but that's more a platonic ideal than a reality)
if it compiles, it's correct.
So this scope excludes ^ all that.
To add more shared ones, just check the "share through vcs" box and commit it.
To use it, just select the scope from the dropdown when you search. E.g. "find in files" ->
change from "in project" to "scope" -> change the dropdown. This custom scope will now appear,
and it'll remember what you last used, so it's a nice default.
This also works in "call hierarchy", "go to implementations" (open it in a panel to configure it,
with the gear on the side. it's awful UI but it works), etc quite a lot of places.
This same kinda-obtuse search-scope query language can be used to mark things as generated or test
related, which will also help other parts of the IDE mark things as more or less relevant for you.
It's worth exploring a bit, scopes and filters can be used to do a lot: https://www.jetbrains.com/help/idea/scope-language-syntax-reference.html