Skip to content

glob filter for implementation and reference #3702

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

Open
7sunarni opened this issue Mar 6, 2025 · 1 comment
Open

glob filter for implementation and reference #3702

7sunarni opened this issue Mar 6, 2025 · 1 comment

Comments

@7sunarni
Copy link

7sunarni commented Mar 6, 2025

Is your feature request related to a problem? Please describe.
Sometimes, when we want to find one function had been used in somewhere, we may found there are lots of reference in some test files or some mock files.

Usually, we may skip this references when we view the popup window.

And this is same like to do some search in the vscode global search bar, and there we can config files to include and/or files to exclude to filter out some files we don't care.

Image

I just think if the extension can do same filter in find references, it will save much time when the project is huge.

Describe the solution you'd like

I migrated the vscode glob implementation code so the extension can behave to the vscode search glob.
Then I added some filters in the reference and implementation function. And I shared my extension to my workmates, I think this actually make us easier to work in huge project(we need to check the Kubernetes code)

and this is my settings

{
...
    "go.implementation": {
        "filesExclude":"{**/fake/**,**/*_test.go,**/testing/**}",
    },
    "go.reference": {
        "filesExclude":"{**/fake/**,**/*_test.go,**/testing/**,**/test/**}",
    },
...
}

Describe alternatives you've considered
If the gopls have some options to do filter, it would may be better and easy.

Additional context
vscode glob implementation doesn't export to its extension library. This may dependent on that.

@gopherbot gopherbot added this to the Untriaged milestone Mar 6, 2025
@h9jiang
Copy link
Member

h9jiang commented Mar 6, 2025

cc @findleyr @adonovan

This remind me of another feature request to re-arranging code actions returned from gopls. Maybe some grammar similar to the glob expression in DirectoryFilters where users can exclude certain patterns.

Or deprioritizing references found in _test.go or */testdata/*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants