-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Bug] When completion Item description is empty, Powershell completion is not working #1229
Comments
Hey, I have a PR #1208 which brings a bunch of improvements for powershell completions including the support for custom args completion. This should fix your issue. I would appreciate if you would test this out. Thanks. |
@Luap99 Thanks for letting me know. I'll test it out. |
@SilkyFowl Did you had time to test my PR? |
@Luap99 However, I commented on one point that I was concerned about. I really wanted to do some detailed testing, but it was a foolhardy challenge for me to build and actually run it when I don't know the Go lang ...... |
This issue is being marked as stale due to a long period of inactivity |
cobra/powershell_completions_test.go
Lines 50 to 85 in 7f8e83d
From this issue: cli/cli/issues/1775
I found that 4th argument of
CompletionResult
's constructor can't use empty string.Steps to reproduce
Expected behavior
Offer completions.
Actual behavior
NOT offer completions.
However,
<command> <tab>
offer completions.After investigating this bug, I found that if the 4th argument of
CompletionResult
's constructor is emptystring, it is interpreted asnull
and anMethodInvocationException
is thrown.In order to avoid this, it seems to be necessary to set some string, even if it is a whitespace.
So what should the 4th argument be set to?
when the 1st and 2nd arguments are the same
MsDocs said this.
So I tried setting the same value as the 1st and 2nd arguments.
From this result, it seems that if no details for the completions is shown, it's OK to set the same string as the 1st and 2nd arguments instead of an empty string.
when the 1st and 2nd arguments are different
This is also the case assumed in
powershell_completions_test.go
. I also checked how it behaves when the 1st argument, which is used as the auto completion result, and the 2nd argument, which is displayed in a list, are different.It seems that at the least Console only needs to set one of the arguments and there is no clear difference.
In VScode
I was somewhat curious about the last one, so I looked into it and found some interesting results.
Whitespace and When the 1st and 2nd arguments are the same
In the same case as the 1st argument
In the same case as the 2nd argument
Considering the difference, I wondered if it should be the same string as the 1st argument.
Because in some settings it is possible to see the 1st argument which is not displayed until selected.
FIX
So my suggestion is to modify the test case as follows.
I think fixing it to pass this modified test will fix the bug.
Environment data
The text was updated successfully, but these errors were encountered: