예제 #1
0
        private static List <Hashtable> InitializeSuggestions()
        {
            var suggestions = new List <Hashtable>(
                new Hashtable[]
            {
                NewSuggestion(
                    id: 1,
                    category: "Transactions",
                    matchType: SuggestionMatchType.Command,
                    rule: "^Start-Transaction",
                    suggestion: SuggestionStrings.Suggestion_StartTransaction,
                    enabled: true),
                NewSuggestion(
                    id: 2,
                    category: "Transactions",
                    matchType: SuggestionMatchType.Command,
                    rule: "^Use-Transaction",
                    suggestion: SuggestionStrings.Suggestion_UseTransaction,
                    enabled: true),
                NewSuggestion(
                    id: 3,
                    category: "General",
                    matchType: SuggestionMatchType.Dynamic,
                    rule: ScriptBlock.CreateDelayParsedScriptBlock(s_checkForCommandInCurrentDirectoryScript, isProductCode: true),
                    suggestion: ScriptBlock.CreateDelayParsedScriptBlock(s_createCommandExistsInCurrentDirectoryScript, isProductCode: true),
                    suggestionArgs: new object[] { CodeGeneration.EscapeSingleQuotedStringContent(SuggestionStrings.Suggestion_CommandExistsInCurrentDirectory) },
                    enabled: true)
            });

            if (ExperimentalFeature.IsEnabled("PSCommandNotFoundSuggestion"))
            {
                suggestions.Add(
                    NewSuggestion(
                        id: 4,
                        category: "General",
                        matchType: SuggestionMatchType.ErrorId,
                        rule: "CommandNotFoundException",
                        suggestion: ScriptBlock.CreateDelayParsedScriptBlock(s_getFuzzyMatchedCommands, isProductCode: true),
                        suggestionArgs: new object[] { CodeGeneration.EscapeSingleQuotedStringContent(SuggestionStrings.Suggestion_CommandNotFound) },
                        enabled: true));
            }

            return(suggestions);
        }