Enable completions for blank between comma and something#17078
Conversation
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
@MartinGC94, can you please take a quick look at this PR and see if there could be any unwanted side effects after adding |
|
The code doesn't work. |
|
@MartinGC94 Thanks for catching it! Just tried and found that |
|
No this PR doesn't seem to fix anything. |
|
@daxian-dbw @MartinGC94 Thank you for your reply and I am sorry for my mistake. I have tested it again. It works for the following commands:
But it does not work, as you say, for Why? I think it is because the Actually, my motive in the first place is to fix Additionally, I just care about the Based on the above, I would like to propose the following fixes:
|
|
Yeah that sounds right, it did look like there was some Enum related code when I stepped through it yesterday. The only problem with a partial fix is that it causes the tab completion code to throw when you try with Enums and ideally it would never throw but throwing doesn't cause any issues as far as I know. |
c609f10 to
01e4800
Compare
Thank you for your advice. I have fixed it this time for sur... probably:smile:. Please review the code. |
src/System.Management.Automation/engine/CommandCompletion/CompletionAnalysis.cs
Outdated
Show resolved
Hide resolved
|
It looks good now. If you want to also fix it with a space between the comma and cursor you can change line 4128 in CompletionCompleters from This also fixes the scenario where you move the cursor between a parameter with a colon and a current value like: |
01e4800 to
86c28c6
Compare
|
Updated @MartinGC94's suggested lines (thanks!) and test cases. |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
daxian-dbw
left a comment
There was a problem hiding this comment.
LGTM. Made a couple updates on the comments.
|
🎉 Handy links: |
PR Summary
Tab completions for a blank between a comma and something (e.g. parameter) does not work.
For example, the No. 1 in the following cases works well, but the No. 2 does not:
lastAstlastAst isGet-Command -Type Alias,<tab>Get-Command -Type Alias,<tab> -AllThat is because the tab completion is triggered if the
lastAstisErrorExpressionAst. Not triggered ifArrayLiteralAst. There are same issues other than theGet-Command, for example,dir(Get-ChildItem),Get-Alias,Get-Module, etc.I have fixed the condition of triggering the tab completion. It is triggered if the
lastAstisErrorExpressionAstorArrayLiteralAst.PR Context
It helps us to modify such an array, especially when we use Alt+a key (SelectCommandArguments).
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.