-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Show optional parameters as such when dislplaying method definition and overloads #13799
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
Show optional parameters as such when dislplaying method definition and overloads #13799
Conversation
@iSazonov it seems like PowerShell/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs Lines 5312 to 5318 in 67bdf72
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems like CompletionCompleters also uses a method definition for the tooltip. Is it possible to test that case somehow?
You can use TabCompletion2 (see our tests how it is used).
test/powershell/engine/Api/GetMethodInfoOverloadDefinition.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/engine/Api/GetMethodInfoOverloadDefinition.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/engine/Api/GetMethodInfoOverloadDefinition.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/engine/Api/GetMethodInfoOverloadDefinition.Tests.ps1
Outdated
Show resolved
Hide resolved
I couldn't find TabCompletion2 anywhere. Do you mean TabExpansion2? Anyway, as far as I understand, tab completion completes just method name and there are already tests for that.
Rather, "method signature with parameters of various types such as parameters passed by reference, generic and optional parameters", but it seems to me, we could combine tests for the overloaded definition and different method signature into one context. I also want to suggest to mark parameters passed by reference with |
Tab expansion results include a tooltip, which is only shown in editors and some PSReadLine key handlers (but not the Tab one). You can see it here: (TabExpansion2 -inputScript ($s = '$Host.PushRunspace') -cursorColumn $s.Length).CompletionMatches returns
Maybe best to open an issue to discuss that one. Part of the problem there is that |
Yes, sorry. |
@iSazonov @SeeminglyScience thanks for helping me! I've added tests for the TabExpansion2 tooltip. |
test/powershell/engine/Api/GetMethodInfoOverloadDefinition.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/engine/Api/GetMethodInfoOverloadDefinition.Tests.ps1
Outdated
Show resolved
Hide resolved
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/rebase |
Started rebase: https://github.com/PowerShell/PowerShell/actions/runs/2343284398
|
@TravisEz13 Could you please look the rebase error? https://github.com/PowerShell/PowerShell/runs/6483334261?check_suite_focus=true#step:5:31
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
🎉 Handy links: |
PR Summary
These changes provide more informative method definition for methods with the optional parameters.
PR Context
Fix #13728
The changes don't cover a case with an
OptionalAttribute
. Calling such a method without optional arguments throws an exception.I could investigate it if you show me where to start.
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.