- 
                Notifications
    You must be signed in to change notification settings 
- Fork 8k
          Add completion single/double quote support for -Noun parameter
          #24977
        
          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
  
    Add completion single/double quote support for -Noun parameter
  
  #24977
              Conversation
| /azp run | 
| Azure Pipelines successfully started running 2 pipeline(s). | 
| /azp run | 
| Azure Pipelines successfully started running 2 pipeline(s). | 
| @ArmaanMcleod Please look failed tests. It seems previously had fake ordering for CompletionResult type. | 
| @iSazonov It looks like tests need to exclude Gridview cmdlets for Mac and Linux, hench test failures. These cmdlets only available on Windows. I will fix this. | 
…k for different operation systems
| /azp run | 
| Azure Pipelines successfully started running 2 pipeline(s). | 
| @iSazonov I think it should be fine now. Thanks for the help. I ran tests on Windows and Linux and it seems to be fine, hoping CI lets it go through 😄. | 
| { | ||
| Collection<CommandInfo> commands = CompletionCompleters.GetCommandInfo(fakeBoundParameters, "Module", "Verb"); | ||
| SortedSet<string> nouns = new(StringComparer.OrdinalIgnoreCase); | ||
| SortedSet<string> nouns = new(); | 
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.
If cmdlet names are case-insensetive on all OS-s this must be case-insensetive too. I think we should think about fixing tests only.
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.
Yep I agree, although to completer it does not make a difference. I have updated code & test. Only way is to use sorted set in the test becauseSort-Object -Unique gives different ordering on Linux. I think this is fine because it is an accurate comparison anyways.
      
        
              This comment was marked as outdated.
        
        
      
    
  This comment was marked as outdated.
      
        
              This comment was marked as outdated.
        
        
      
    
  This comment was marked as outdated.
| 📣 Hey @ArmaanMcleod, how did we do? We would love to hear your feedback with the link below! 🗣️ 🔗 https://aka.ms/PSRepoFeedback | 
PR Summary
Use
CompletionCompleters.GetMatchingResultsinNounArgumentCompleterso-Nounparameter forGet-Commandhas support for single/double quotes.Also made the following improvements:
-Verbis used, only get nouns which are possible with the following verbs.SortedSet<string>withStringComparer.IgnoreCaseto ensure all nouns are unique and sorted and case insensitive. Also removed previous LINQOrder()call with this change.Get-Commandlogic intoCompletionCompleters.GetCommandInfomethod. This can probably be used elsewhere and potentially reduce duplication of command querying code in completers. Also addusingfor creating powershell instance so its automatically disposed.I also added some tab completion tests which seem to be missing for this completer.
PR Context
Related to #24873
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).