mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add tooltips for hashtable key completions (#17864)
This commit is contained in:
+134
-54
@@ -5989,12 +5989,13 @@ namespace System.Management.Automation
|
||||
|
||||
// Produce completions for all parameters that begin with the prefix we've found,
|
||||
// but which haven't already been specified in the line we need to complete
|
||||
foreach (KeyValuePair<string, string> parameter in s_requiresParameters)
|
||||
foreach (string parameter in s_requiresParameters)
|
||||
{
|
||||
if (parameter.Key.StartsWith(currentParameterPrefix, StringComparison.OrdinalIgnoreCase)
|
||||
&& !context.CursorPosition.Line.Contains($" -{parameter.Key}", StringComparison.OrdinalIgnoreCase))
|
||||
if (parameter.StartsWith(currentParameterPrefix, StringComparison.OrdinalIgnoreCase)
|
||||
&& !context.CursorPosition.Line.Contains($" -{parameter}", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
results.Add(new CompletionResult(parameter.Key, parameter.Key, CompletionResultType.ParameterName, parameter.Value));
|
||||
string toolTip = GetRequiresParametersToolTip(parameter);
|
||||
results.Add(new CompletionResult(parameter, parameter, CompletionResultType.ParameterName, toolTip));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6019,11 +6020,12 @@ namespace System.Management.Automation
|
||||
// Complete PSEdition parameter values
|
||||
if (currentParameterMatch.Value.Equals("PSEdition", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
foreach (KeyValuePair<string, string> psEditionEntry in s_requiresPSEditions)
|
||||
foreach (string psEditionEntry in s_requiresPSEditions)
|
||||
{
|
||||
if (psEditionEntry.Key.StartsWith(currentValue, StringComparison.OrdinalIgnoreCase))
|
||||
if (psEditionEntry.StartsWith(currentValue, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
results.Add(new CompletionResult(psEditionEntry.Key, psEditionEntry.Key, CompletionResultType.ParameterValue, psEditionEntry.Value));
|
||||
string toolTip = GetRequiresPsEditionsToolTip(psEditionEntry);
|
||||
results.Add(new CompletionResult(psEditionEntry, psEditionEntry, CompletionResultType.ParameterValue, toolTip));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6051,7 +6053,7 @@ namespace System.Management.Automation
|
||||
hashtableKeyMatches = Regex.Matches(hashtableString, @"(@{|;)\s*(?:'|\""|\w*)\w*");
|
||||
|
||||
// Build the list of keys we might want to complete, based on what's already been provided
|
||||
var moduleSpecKeysToComplete = new HashSet<string>(s_requiresModuleSpecKeys.Keys);
|
||||
var moduleSpecKeysToComplete = new HashSet<string>(s_requiresModuleSpecKeys);
|
||||
bool sawModuleNameLast = false;
|
||||
foreach (Match existingHashtableKeyMatch in hashtableKeyMatches)
|
||||
{
|
||||
@@ -6107,7 +6109,8 @@ namespace System.Management.Automation
|
||||
{
|
||||
if (moduleSpecKey.StartsWith(currentValue, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
results.Add(new CompletionResult(moduleSpecKey, moduleSpecKey, CompletionResultType.ParameterValue, s_requiresModuleSpecKeys[moduleSpecKey]));
|
||||
string toolTip = GetRequiresModuleSpecKeysToolTip(moduleSpecKey);
|
||||
results.Add(new CompletionResult(moduleSpecKey, moduleSpecKey, CompletionResultType.ParameterValue, toolTip));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6115,27 +6118,53 @@ namespace System.Management.Automation
|
||||
return results;
|
||||
}
|
||||
|
||||
private static readonly IReadOnlyDictionary<string, string> s_requiresParameters = new SortedList<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
private static readonly string[] s_requiresParameters = new string[]
|
||||
{
|
||||
{ "Modules", "Specifies PowerShell modules that the script requires." },
|
||||
{ "PSEdition", "Specifies a PowerShell edition that the script requires." },
|
||||
{ "RunAsAdministrator", "Specifies that PowerShell must be running as administrator on Windows." },
|
||||
{ "Version", "Specifies the minimum version of PowerShell that the script requires." },
|
||||
"Modules",
|
||||
"PSEdition",
|
||||
"RunAsAdministrator",
|
||||
"Version"
|
||||
};
|
||||
|
||||
private static readonly IReadOnlyDictionary<string, string> s_requiresPSEditions = new SortedList<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
private static string GetRequiresParametersToolTip(string name) => name switch
|
||||
{
|
||||
{ "Core", "Specifies that the script requires PowerShell Core to run." },
|
||||
{ "Desktop", "Specifies that the script requires Windows PowerShell to run." },
|
||||
"Modules" => TabCompletionStrings.RequiresModulesParameterDescription,
|
||||
"PSEdition" => TabCompletionStrings.RequiresPSEditionParameterDescription,
|
||||
"RunAsAdministrator" => TabCompletionStrings.RequiresRunAsAdministratorParameterDescription,
|
||||
"Version" => TabCompletionStrings.RequiresVersionParameterDescription,
|
||||
_ => string.Empty
|
||||
};
|
||||
|
||||
private static readonly IReadOnlyDictionary<string, string> s_requiresModuleSpecKeys = new SortedList<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
private static readonly string[] s_requiresPSEditions = new string[]
|
||||
{
|
||||
{ "ModuleName", "Required. Specifies the module name." },
|
||||
{ "GUID", "Optional. Specifies the GUID of the module." },
|
||||
{ "ModuleVersion", "Specifies a minimum acceptable version of the module." },
|
||||
{ "RequiredVersion", "Specifies an exact, required version of the module." },
|
||||
{ "MaximumVersion", "Specifies the maximum acceptable version of the module." },
|
||||
"Core",
|
||||
"Desktop"
|
||||
};
|
||||
|
||||
private static string GetRequiresPsEditionsToolTip(string name) => name switch
|
||||
{
|
||||
"Core" => TabCompletionStrings.RequiresPsEditionCoreDescription,
|
||||
"Desktop" => TabCompletionStrings.RequiresPsEditionDesktopDescription,
|
||||
_ => string.Empty
|
||||
};
|
||||
|
||||
private static readonly string[] s_requiresModuleSpecKeys = new string[]
|
||||
{
|
||||
"GUID",
|
||||
"MaximumVersion",
|
||||
"ModuleName",
|
||||
"ModuleVersion",
|
||||
"RequiredVersion"
|
||||
};
|
||||
|
||||
private static string GetRequiresModuleSpecKeysToolTip(string name) => name switch
|
||||
{
|
||||
"GUID" => TabCompletionStrings.RequiresModuleSpecGUIDDescription,
|
||||
"MaximumVersion" => TabCompletionStrings.RequiresModuleSpecMaximumVersionDescription,
|
||||
"ModuleName" => TabCompletionStrings.RequiresModuleSpecModuleNameDescription,
|
||||
"ModuleVersion" => TabCompletionStrings.RequiresModuleSpecModuleVersionDescription,
|
||||
"RequiredVersion" => TabCompletionStrings.RequiresModuleSpecRequiredVersionDescription,
|
||||
_ => string.Empty
|
||||
};
|
||||
|
||||
private static readonly char[] s_hashtableKeyPrefixes = new[]
|
||||
@@ -6180,7 +6209,7 @@ namespace System.Management.Automation
|
||||
replacementIndex = context.TokenAtCursor.Extent.StartOffset + lineKeyword.Index;
|
||||
replacementLength = lineKeyword.Value.Length;
|
||||
|
||||
var validKeywords = new HashSet<String>(s_commentHelpKeywords.Keys, StringComparer.OrdinalIgnoreCase);
|
||||
var validKeywords = new HashSet<string>(s_commentHelpKeywords, StringComparer.OrdinalIgnoreCase);
|
||||
foreach (Match keyword in usedKeywords)
|
||||
{
|
||||
if (keyword == lineKeyword || s_commentHelpAllowedDuplicateKeywords.Contains(keyword.Value))
|
||||
@@ -6196,7 +6225,8 @@ namespace System.Management.Automation
|
||||
{
|
||||
if (keyword.StartsWith(lineKeyword.Value, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
result.Add(new CompletionResult(keyword, keyword, CompletionResultType.Keyword, s_commentHelpKeywords[keyword]));
|
||||
string toolTip = GetCommentHelpKeywordsToolTip(keyword);
|
||||
result.Add(new CompletionResult(keyword, keyword, CompletionResultType.Keyword, toolTip));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6256,46 +6286,66 @@ namespace System.Management.Automation
|
||||
return null;
|
||||
}
|
||||
|
||||
private static readonly IReadOnlyDictionary<string, string> s_commentHelpKeywords = new SortedList<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
private static readonly string[] s_commentHelpKeywords = new string[]
|
||||
{
|
||||
{ "SYNOPSIS", "A brief description of the function or script. This keyword can be used only once in each topic." },
|
||||
{ "DESCRIPTION", "A detailed description of the function or script. This keyword can be used only once in each topic." },
|
||||
{ "PARAMETER", ".PARAMETER <Parameter-Name>\nThe description of a parameter. Add a .PARAMETER keyword for each parameter in the function or script syntax." },
|
||||
{ "EXAMPLE", "A sample command that uses the function or script, optionally followed by sample output and a description. Repeat this keyword for each example." },
|
||||
{ "INPUTS", "The .NET types of objects that can be piped to the function or script. You can also include a description of the input objects." },
|
||||
{ "OUTPUTS", "The .NET type of the objects that the cmdlet returns. You can also include a description of the returned objects." },
|
||||
{ "NOTES", "Additional information about the function or script." },
|
||||
{ "LINK", "The name of a related topic. Repeat the .LINK keyword for each related topic. The .Link keyword content can also include a URI to an online version of the same help topic." },
|
||||
{ "COMPONENT", "The name of the technology or feature that the function or script uses, or to which it is related." },
|
||||
{ "ROLE", "The name of the user role for the help topic." },
|
||||
{ "FUNCTIONALITY", "The keywords that describe the intended use of the function." },
|
||||
{ "FORWARDHELPTARGETNAME", ".FORWARDHELPTARGETNAME <Command-Name>\nRedirects to the help topic for the specified command." },
|
||||
{ "FORWARDHELPCATEGORY", ".FORWARDHELPCATEGORY <Category>\nSpecifies the help category of the item in .ForwardHelpTargetName" },
|
||||
{ "REMOTEHELPRUNSPACE", ".REMOTEHELPRUNSPACE <PSSession-variable>\nSpecifies a session that contains the help topic. Enter a variable that contains a PSSession object." },
|
||||
{ "EXTERNALHELP", ".EXTERNALHELP <XML Help File>\nThe .ExternalHelp keyword is required when a function or script is documented in XML files." }
|
||||
"COMPONENT",
|
||||
"DESCRIPTION",
|
||||
"EXAMPLE",
|
||||
"EXTERNALHELP",
|
||||
"FORWARDHELPCATEGORY",
|
||||
"FORWARDHELPTARGETNAME",
|
||||
"FUNCTIONALITY",
|
||||
"INPUTS",
|
||||
"LINK",
|
||||
"NOTES",
|
||||
"OUTPUTS",
|
||||
"PARAMETER",
|
||||
"REMOTEHELPRUNSPACE",
|
||||
"ROLE",
|
||||
"SYNOPSIS"
|
||||
};
|
||||
|
||||
private static string GetCommentHelpKeywordsToolTip(string name) => name switch
|
||||
{
|
||||
"COMPONENT" => TabCompletionStrings.CommentHelpCOMPONENTKeywordDescription,
|
||||
"DESCRIPTION" => TabCompletionStrings.CommentHelpDESCRIPTIONKeywordDescription,
|
||||
"EXAMPLE" => TabCompletionStrings.CommentHelpEXAMPLEKeywordDescription,
|
||||
"EXTERNALHELP" => TabCompletionStrings.CommentHelpEXTERNALHELPKeywordDescription,
|
||||
"FORWARDHELPCATEGORY" => TabCompletionStrings.CommentHelpFORWARDHELPCATEGORYKeywordDescription,
|
||||
"FORWARDHELPTARGETNAME" => TabCompletionStrings.CommentHelpFORWARDHELPTARGETNAMEKeywordDescription,
|
||||
"FUNCTIONALITY" => TabCompletionStrings.CommentHelpFUNCTIONALITYKeywordDescription,
|
||||
"INPUTS" => TabCompletionStrings.CommentHelpINPUTSKeywordDescription,
|
||||
"LINK" => TabCompletionStrings.CommentHelpLINKKeywordDescription,
|
||||
"NOTES" => TabCompletionStrings.CommentHelpNOTESKeywordDescription,
|
||||
"OUTPUTS" => TabCompletionStrings.CommentHelpOUTPUTSKeywordDescription,
|
||||
"PARAMETER" => TabCompletionStrings.CommentHelpPARAMETERKeywordDescription,
|
||||
"REMOTEHELPRUNSPACE" => TabCompletionStrings.CommentHelpREMOTEHELPRUNSPACEKeywordDescription,
|
||||
"ROLE" => TabCompletionStrings.CommentHelpROLEKeywordDescription,
|
||||
"SYNOPSIS" => TabCompletionStrings.CommentHelpSYNOPSISKeywordDescription,
|
||||
_ => string.Empty
|
||||
};
|
||||
|
||||
private static readonly HashSet<string> s_commentHelpAllowedDuplicateKeywords = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
"PARAMETER",
|
||||
"EXAMPLE",
|
||||
"LINK"
|
||||
"LINK",
|
||||
"PARAMETER"
|
||||
};
|
||||
|
||||
private static readonly string[] s_commentHelpForwardCategories = new string[]
|
||||
{
|
||||
"Alias",
|
||||
"All",
|
||||
"Cmdlet",
|
||||
"HelpFile",
|
||||
"Function",
|
||||
"Provider",
|
||||
"General",
|
||||
"FAQ",
|
||||
"Glossary",
|
||||
"ScriptCommand",
|
||||
"ExternalScript",
|
||||
"FAQ",
|
||||
"Filter",
|
||||
"All"
|
||||
"Function",
|
||||
"General",
|
||||
"Glossary",
|
||||
"HelpFile",
|
||||
"Provider",
|
||||
"ScriptCommand"
|
||||
};
|
||||
|
||||
private static FunctionDefinitionAst GetCommentHelpFunctionTarget(CompletionContext context)
|
||||
@@ -8066,7 +8116,7 @@ namespace System.Management.Automation
|
||||
}
|
||||
|
||||
var result = new List<CompletionResult>();
|
||||
foreach (var key in s_requiresModuleSpecKeys.Keys)
|
||||
foreach (string key in s_requiresModuleSpecKeys)
|
||||
{
|
||||
if (excludedKeys.Contains(key)
|
||||
|| (wordToComplete is not null && !key.StartsWith(wordToComplete, StringComparison.OrdinalIgnoreCase))
|
||||
@@ -8075,7 +8125,10 @@ namespace System.Management.Automation
|
||||
{
|
||||
continue;
|
||||
}
|
||||
result.Add(new CompletionResult(key, key, CompletionResultType.Property, s_requiresModuleSpecKeys[key]));
|
||||
|
||||
string toolTip = GetRequiresModuleSpecKeysToolTip(key);
|
||||
|
||||
result.Add(new CompletionResult(key, key, CompletionResultType.Property, toolTip));
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -8327,7 +8380,9 @@ namespace System.Management.Automation
|
||||
{
|
||||
if ((string.IsNullOrEmpty(wordToComplete) || key.StartsWith(wordToComplete, StringComparison.OrdinalIgnoreCase)) && !excludedKeys.Contains(key))
|
||||
{
|
||||
result.Add(new CompletionResult(key, key, CompletionResultType.Property, key));
|
||||
string toolTip = GetHashtableKeyDescriptionToolTip(key);
|
||||
|
||||
result.Add(new CompletionResult(key, key, CompletionResultType.Property, toolTip));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8339,6 +8394,31 @@ namespace System.Management.Automation
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string GetHashtableKeyDescriptionToolTip(string name) => name switch
|
||||
{
|
||||
"Alignment" => TabCompletionStrings.AlignmentHashtableKeyDescription,
|
||||
"Ascending" => TabCompletionStrings.AscendingHashtableKeyDescription,
|
||||
"Data" => TabCompletionStrings.DataHashtableKeyDescription,
|
||||
"Depth" => TabCompletionStrings.DepthHashtableKeyDescription,
|
||||
"Descending" => TabCompletionStrings.DescendingHashtableKeyDescription,
|
||||
"EndTime" => TabCompletionStrings.EndTimeHashtableKeyDescription,
|
||||
"Expression" => TabCompletionStrings.ExpressionHashtableKeyDescription,
|
||||
"FormatString" => TabCompletionStrings.FormatStringHashtableKeyDescription,
|
||||
"ID" => TabCompletionStrings.IDHashtableKeyDescription,
|
||||
"Keywords" => TabCompletionStrings.KeywordsHashtableKeyDescription,
|
||||
"Label" => TabCompletionStrings.LabelHashtableKeyDescription,
|
||||
"Level" => TabCompletionStrings.LevelHashtableKeyDescription,
|
||||
"LogName" => TabCompletionStrings.LogNameHashtableKeyDescription,
|
||||
"Name" => TabCompletionStrings.NameHashtableKeyDescription,
|
||||
"Path" => TabCompletionStrings.PathHashtableKeyDescription,
|
||||
"ProviderName" => TabCompletionStrings.ProviderNameHashtableKeyDescription,
|
||||
"StartTime" => TabCompletionStrings.StartTimeHashtableKeyDescription,
|
||||
"SuppressHashFilter" => TabCompletionStrings.SuppressHashFilterHashtableKeyDescription,
|
||||
"UserID" => TabCompletionStrings.UserIDHashtableKeyDescription,
|
||||
"Width" => TabCompletionStrings.WidthHashtableKeyDescription,
|
||||
_ => string.Empty
|
||||
};
|
||||
|
||||
#endregion Hashtable Keys
|
||||
|
||||
#region Helpers
|
||||
|
||||
@@ -329,6 +329,218 @@
|
||||
<data name="shrOperatorDescription" xml:space="preserve">
|
||||
<value>Shift Right bit operator. Inserts zero in the left-most bit position. For signed values, sign bit is preserved.</value>
|
||||
</data>
|
||||
<data name="NameHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[string]
|
||||
Specifies the name of the property being created.</value>
|
||||
</data>
|
||||
<data name="LabelHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[string]
|
||||
Specifies the name of the property being created.</value>
|
||||
</data>
|
||||
<data name="ExpressionHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[scriptblock]
|
||||
A script block used to calculate the value of the new property.</value>
|
||||
</data>
|
||||
<data name="AlignmentHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[string]
|
||||
Define how the values are displayed in a column.
|
||||
Valid values are 'left', 'center', or 'right'.</value>
|
||||
</data>
|
||||
<data name="FormatStringHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[string]
|
||||
Specifies a format string that defines how the value is formatted for output.</value>
|
||||
</data>
|
||||
<data name="WidthHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[int]
|
||||
Specifies the maximum column width in a table when the value is displayed.
|
||||
The value must be greater than 0.</value>
|
||||
</data>
|
||||
<data name="DepthHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[int]
|
||||
The depth key specifies the depth of expansion per property.</value>
|
||||
</data>
|
||||
<data name="AscendingHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[bool]
|
||||
Specifies the order of sorting for one or more properties.</value>
|
||||
</data>
|
||||
<data name="DescendingHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[bool]
|
||||
Specifies the order of sorting for one or more properties.</value>
|
||||
</data>
|
||||
<data name="LogNameHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[String[]]
|
||||
Specifies the log names to get events from.
|
||||
Supports wildcards.</value>
|
||||
</data>
|
||||
<data name="ProviderNameHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[String[]]
|
||||
Specifies the event log providers to get events from.
|
||||
Supports wildcards.</value>
|
||||
</data>
|
||||
<data name="PathHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[String[]]
|
||||
Specifies file paths to log files to get events from.
|
||||
Valid file formats are: .etl, .evt, and .evtx</value>
|
||||
</data>
|
||||
<data name="KeywordsHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[Long[]]
|
||||
Selects events with the specified keyword bitmasks.
|
||||
The following are standard keywords:
|
||||
4503599627370496: AuditFailure
|
||||
9007199254740992: AuditSuccess
|
||||
4503599627370496: CorrelationHint
|
||||
18014398509481984: CorrelationHint2
|
||||
36028797018963968: EventLogClassic
|
||||
281474976710656: ResponseTime
|
||||
2251799813685248: Sqm
|
||||
562949953421312: WdiContext
|
||||
1125899906842624: WdiDiagnostic</value>
|
||||
</data>
|
||||
<data name="IDHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[int[]]
|
||||
Selects events with the specified event IDs.</value>
|
||||
</data>
|
||||
<data name="LevelHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[int[]]
|
||||
Selects events with the specified log levels.
|
||||
The following log levels are valid:
|
||||
1: Critical
|
||||
2: Error
|
||||
3: Warning
|
||||
4: Informational
|
||||
5: Verbose</value>
|
||||
</data>
|
||||
<data name="StartTimeHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[datetime]
|
||||
Selects events created after the specified date and time.</value>
|
||||
</data>
|
||||
<data name="EndTimeHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[datetime]
|
||||
Selects events created before the specified date and time.</value>
|
||||
</data>
|
||||
<data name="UserIDHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[string]
|
||||
Selects events generated by the specified user.
|
||||
This can either be a string representation of a SID or a domain and username in the format DOMAIN\USERNAME or USERNAME@DOMAIN</value>
|
||||
</data>
|
||||
<data name="DataHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[string[]]
|
||||
Selects events with any of the specified values in the EventData section.</value>
|
||||
</data>
|
||||
<data name="SuppressHashFilterHashtableKeyDescription" xml:space="preserve">
|
||||
<value>[hashtable]
|
||||
Excludes events that match the values specified in the hashtable.</value>
|
||||
</data>
|
||||
<data name="RequiresModulesParameterDescription" xml:space="preserve">
|
||||
<value>[string] or [hashtable]
|
||||
Specifies an array of PowerShell modules that the script requires.
|
||||
Each element can either be a string with the module name as value or a hashtable with the following keys:
|
||||
Name: Name of the module
|
||||
GUID: GUID of the module
|
||||
One of the following:
|
||||
ModuleVersion: Specifies a minimum acceptable version of the module.
|
||||
RequiredVersion: Specifies an exact, required version of the module.
|
||||
MaximumVersion: Specifies the maximum acceptable version of the module.</value>
|
||||
</data>
|
||||
<data name="RequiresPSEditionParameterDescription" xml:space="preserve">
|
||||
<value>[string]
|
||||
Specifies a PowerShell edition that the script requires.
|
||||
Valid values are "Core" and "Desktop"</value>
|
||||
</data>
|
||||
<data name="RequiresRunAsAdministratorParameterDescription" xml:space="preserve">
|
||||
<value>[switch]
|
||||
Specifies that PowerShell must be running as administrator on Windows.
|
||||
This must be the last parameter on the #requires statement line.</value>
|
||||
</data>
|
||||
<data name="RequiresVersionParameterDescription" xml:space="preserve">
|
||||
<value>[version]
|
||||
Specifies the minimum version of PowerShell that the script requires.</value>
|
||||
</data>
|
||||
<data name="RequiresPsEditionCoreDescription" xml:space="preserve">
|
||||
<value>Specifies that the script requires PowerShell Core to run.</value>
|
||||
</data>
|
||||
<data name="RequiresPsEditionDesktopDescription" xml:space="preserve">
|
||||
<value>Specifies that the script requires Windows PowerShell to run.</value>
|
||||
</data>
|
||||
<data name="RequiresModuleSpecModuleNameDescription" xml:space="preserve">
|
||||
<value>[string]
|
||||
Required. Specifies the module name.</value>
|
||||
</data>
|
||||
<data name="RequiresModuleSpecGUIDDescription" xml:space="preserve">
|
||||
<value>[string]
|
||||
Optional. Specifies the GUID of the module.</value>
|
||||
</data>
|
||||
<data name="RequiresModuleSpecModuleVersionDescription" xml:space="preserve">
|
||||
<value>[string]
|
||||
Specifies a minimum acceptable version of the module.</value>
|
||||
</data>
|
||||
<data name="RequiresModuleSpecRequiredVersionDescription" xml:space="preserve">
|
||||
<value>[string]
|
||||
Specifies an exact, required version of the module.</value>
|
||||
</data>
|
||||
<data name="RequiresModuleSpecMaximumVersionDescription" xml:space="preserve">
|
||||
<value>[string]
|
||||
Specifies the maximum acceptable version of the module.</value>
|
||||
</data>
|
||||
<data name="CommentHelpSYNOPSISKeywordDescription" xml:space="preserve">
|
||||
<value>A brief description of the function or script.
|
||||
This keyword can be used only once in each topic.</value>
|
||||
</data>
|
||||
<data name="CommentHelpDESCRIPTIONKeywordDescription" xml:space="preserve">
|
||||
<value>A detailed description of the function or script.
|
||||
This keyword can be used only once in each topic.</value>
|
||||
</data>
|
||||
<data name="CommentHelpPARAMETERKeywordDescription" xml:space="preserve">
|
||||
<value>.PARAMETER <Parameter-Name>
|
||||
The description of a parameter.
|
||||
Add a .PARAMETER keyword for each parameter in the function or script syntax.</value>
|
||||
</data>
|
||||
<data name="CommentHelpEXAMPLEKeywordDescription" xml:space="preserve">
|
||||
<value>A sample command that uses the function or script, optionally followed by sample output and a description.
|
||||
Repeat this keyword for each example.</value>
|
||||
</data>
|
||||
<data name="CommentHelpINPUTSKeywordDescription" xml:space="preserve">
|
||||
<value>The .NET types of objects that can be piped to the function or script.
|
||||
You can also include a description of the input objects.</value>
|
||||
</data>
|
||||
<data name="CommentHelpOUTPUTSKeywordDescription" xml:space="preserve">
|
||||
<value>The .NET type of the objects that the cmdlet returns.
|
||||
You can also include a description of the returned objects.</value>
|
||||
</data>
|
||||
<data name="CommentHelpNOTESKeywordDescription" xml:space="preserve">
|
||||
<value>Additional information about the function or script.</value>
|
||||
</data>
|
||||
<data name="CommentHelpLINKKeywordDescription" xml:space="preserve">
|
||||
<value>The name of a related topic.
|
||||
Repeat the .LINK keyword for each related topic.
|
||||
The .Link keyword content can also include a URI to an online version of the same help topic.</value>
|
||||
</data>
|
||||
<data name="CommentHelpCOMPONENTKeywordDescription" xml:space="preserve">
|
||||
<value>The name of the technology or feature that the function or script uses, or to which it is related.</value>
|
||||
</data>
|
||||
<data name="CommentHelpROLEKeywordDescription" xml:space="preserve">
|
||||
<value>The name of the user role for the help topic.</value>
|
||||
</data>
|
||||
<data name="CommentHelpFUNCTIONALITYKeywordDescription" xml:space="preserve">
|
||||
<value>The keywords that describe the intended use of the function.</value>
|
||||
</data>
|
||||
<data name="CommentHelpFORWARDHELPTARGETNAMEKeywordDescription" xml:space="preserve">
|
||||
<value>.FORWARDHELPTARGETNAME <Command-Name>
|
||||
Redirects to the help topic for the specified command.</value>
|
||||
</data>
|
||||
<data name="CommentHelpFORWARDHELPCATEGORYKeywordDescription" xml:space="preserve">
|
||||
<value>.FORWARDHELPCATEGORY <Category>
|
||||
Specifies the help category of the item in .ForwardHelpTargetName</value>
|
||||
</data>
|
||||
<data name="CommentHelpREMOTEHELPRUNSPACEKeywordDescription" xml:space="preserve">
|
||||
<value>.REMOTEHELPRUNSPACE <PSSession-variable>
|
||||
Specifies a session that contains the help topic.
|
||||
Enter a variable that contains a PSSession object.</value>
|
||||
</data>
|
||||
<data name="CommentHelpEXTERNALHELPKeywordDescription" xml:space="preserve">
|
||||
<value>.EXTERNALHELP <XML Help File>
|
||||
The .ExternalHelp keyword is required when a function or script is documented in XML files.</value>
|
||||
</data>
|
||||
<data name="AssemblyKeywordDescription" xml:space="preserve">
|
||||
<value>Specifies the path to a .NET assembly to load.
|
||||
|
||||
|
||||
@@ -2557,7 +2557,7 @@ param ($Param1)
|
||||
}
|
||||
|
||||
It "Test hashtable key completion in #requires statement for modules" {
|
||||
$res = TabExpansion2 -inputScript "#requires -Modules @{" -cursorColumn 21
|
||||
$res = TabExpansion2 -inputScript "#requires -Modules @{"
|
||||
$res.CompletionMatches.Count | Should -BeGreaterThan 0
|
||||
$res.CompletionMatches[0].CompletionText | Should -BeExactly "GUID"
|
||||
}
|
||||
@@ -3226,23 +3226,23 @@ dir -Recurse `
|
||||
}
|
||||
It '<Intent>' -TestCases @(
|
||||
@{
|
||||
Intent = 'Complete help keywords with minimum input'
|
||||
Intent = 'Complete help keywords with minimal input'
|
||||
Expected = @(
|
||||
'COMPONENT'
|
||||
'DESCRIPTION'
|
||||
'EXAMPLE'
|
||||
'EXTERNALHELP'
|
||||
'FORWARDHELPCATEGORY'
|
||||
'FORWARDHELPTARGETNAME'
|
||||
'FUNCTIONALITY'
|
||||
'INPUTS'
|
||||
'LINK'
|
||||
'NOTES'
|
||||
'OUTPUTS'
|
||||
'PARAMETER'
|
||||
'REMOTEHELPRUNSPACE'
|
||||
'ROLE'
|
||||
'SYNOPSIS'
|
||||
"COMPONENT",
|
||||
"DESCRIPTION",
|
||||
"EXAMPLE",
|
||||
"EXTERNALHELP",
|
||||
"FORWARDHELPCATEGORY",
|
||||
"FORWARDHELPTARGETNAME",
|
||||
"FUNCTIONALITY",
|
||||
"INPUTS",
|
||||
"LINK",
|
||||
"NOTES",
|
||||
"OUTPUTS",
|
||||
"PARAMETER",
|
||||
"REMOTEHELPRUNSPACE",
|
||||
"ROLE",
|
||||
"SYNOPSIS"
|
||||
)
|
||||
TestString = @'
|
||||
<#
|
||||
@@ -3432,6 +3432,7 @@ function MyFunction ($param1, $param2)
|
||||
It 'Should complete module specification keys in using module statement' {
|
||||
$res = TabExpansion2 -inputScript 'using module @{'
|
||||
$res.CompletionMatches.CompletionText -join ' ' | Should -BeExactly "GUID MaximumVersion ModuleName ModuleVersion RequiredVersion"
|
||||
$res.CompletionMatches[0].ToolTip | Should -Not -Be $res.CompletionMatches[0].CompletionText
|
||||
}
|
||||
|
||||
It 'Should not fallback to file completion when completing typenames' {
|
||||
|
||||
Reference in New Issue
Block a user