-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: suggest testing.F if function name starts with Fuzz* #46896
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
Comments
Would like to work on this cc/ @hyangah |
And I wonder if gopls can handle autocomplete specially for |
That is a very good idea, and easy to implement! Please open a separate issue, in gopls/on-deck. It can be help-wanted too as this should be straightforward to add. |
I completely forgot about this issue, will work on this over the weekend, thanks for the ping :) |
Sorry for the huge delay on this. @hyangah while looking into this, I realized we don't show/order completions based on the function name, please correct me If I'm wrong here. Based on the above, I tried a very brittle implementation which essentially compares the enclosing function with all the shortlisted candidates and orders them accordingly. The output looks something like this:
It does the same for cc: @findleyr |
I'm unclear on what's being requested/proposed in this issue. In a test file, after the '.', there's only one legal completion in Best would be to offer to complete the whole signature after the user types the '(', but gopls does not generate completions when it sees '('. Intermediate would be to offer ' *testing.T' when the user types the formal parameter in 'func TestFoo(t' (and ' *testing.F' for 'FuzzFoo(f' etc). |
Throughout typing, I've never seen As @danishprakash found out, there is no specialization for test/bench functions either so same problem exists for |
Change https://go.dev/cl/385974 mentions this issue: |
I would definitely like to see this completion list prioritized to put the "right" struct type at the top; I suggested using snippet completion on above CL (to complete the full signature with an empty placeholder or something), but for those that don't use snippet completions, the sorting would be a marked improvement. For me, it's definitely more useful than "doesn't save the user much" would imply. |
The text was updated successfully, but these errors were encountered: