- Notifications
You must be signed in to change notification settings - Fork8.1k
Improve the completion for attribute arguments#25129
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
iSazonov commentedMar 5, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@MartinGC94 If it is a regression could you please point in the PR description where it comes from (PR/commit)? If possible of course. |
It seems to have been this one:#17902 but this new PR is not just a fix for this regression. It's (hopefully) a fix for all the oddities regarding attribute argument completion. |
Hmm, looks like I was a bit too ambitious with what it could do. I removed the test as I don't see a way to fix it. There are no related asts around the cursor on a new line so I can't really find my way back to the attribute ast and be sure that this is what should be completed. It's not terribly important though, I've never seen anyone place attribute arguments on separate lines. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
d820692 intoPowerShell:masterUh oh!
There was an error while loading.Please reload this page.
microsoft-github-policy-servicebot commentedMar 6, 2025 • edited by unfurl-linksbot
Loading Uh oh!
There was an error while loading.Please reload this page.
edited by unfurl-linksbot
Uh oh!
There was an error while loading.Please reload this page.
📣 Hey@MartinGC94, how did we do? We would love to hear your feedback with the link below! 🗣️ 🔗https://aka.ms/PSRepoFeedback |
Uh oh!
There was an error while loading.Please reload this page.
PR Summary
Improves the argument completion for attributes so it can work in all scenarios I can think of.
Today the attribute completion only works reliably when you have a variable to bind the attribute to, as the parser throws away the AttributeAst if it can't find a variable. I have fixed this by adding the parsed AttributeAsts to the ErrorExpression that would be created in this case.
Inside a param block the parser already keeps the parsed attributes like this so I have updated the completion code to also handle how the attributes are stored for incomplete parameters inside the param block.
PR Context
Fixes#25111
Regression comes from#17902
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.- [ ] Issue filed:
(which runs in a different PS Host).