Add completion for Requires statements#14596
Conversation
|
Please convert out of draft, change the title and ping me when this PR is ready for review |
|
@rjmholt ping pong, this PR is now ready for review. |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
I was writing a review of this, but realised it would be easier (given editor assistance) to open a PR on your branch: MartinGC94#1 I've done the following things:
|
|
One thing this PR needs though is more tests; there should essentially be a test to cover each block in the logic |
Suggested changes to #requires completions PR
|
Thanks for the great feedback, this is a good learning experience. |
|
@MartinGC94 this is great work! Thanks so much for your contribution. Hopefully in the PR I submitted to your branch you were able to read it commit by commit to get a sense of the particular changes? |
|
The static analysis is for existing code |
|
🎉 Handy links: |
PR Summary
This adds completion for the various parameters and their values for #requires statements.
For example:
#requires -PSEdition Core -RunAsAdministratorThe following parameters are supported:
The following parameters are not supported because they have been deprecated or don't work:
Most of the help text has been taken from the official docs but I took some creative liberties for the PSEditions text.
I'm not sure how strict the completion should be.
Currently it will prevent some basic mistakes like adding parameters after
RunAsAdministratorbut there's no special checks for randomly inserted characters so if for example you type:#requires blabla -<Tab>it will still complete to the next parameter.PR Context
The easier the requires statements are to use, the more likely it is that people will use them. The Modules parameter in particular is hard to use without looking up the documentation due to the hashtable keys you have to remember when specifying a version.
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.