Beispiel #1
0
        public AutoCompletionResult AutoComplete(string line)
        {
            var result = ParsingHelpers.AutoCompleteCommandBody(line, this);

            if (result.WasSuccessful == AutoCompletionResultType.FailureAlreadyComplete)
            {
                foreach (var command in GConsole.Instance.Commands)
                {
                    var resultSecond = ParsingHelpers.AutoCompleteCommandBody(line.Substring(result.RemainderStartPosition), command);
                    if (resultSecond.WasSuccessful == AutoCompletionResultType.SuccessOneOption)
                    {
                        var finalResult = new AutoCompletionResult();
                        finalResult.WasSuccessful = AutoCompletionResultType.SuccessOneOption;
                        finalResult.Results.Add(line.Substring(0, result.RemainderStartPosition - 1) + " " + resultSecond.Results[0]);
                        return(finalResult);
                    }
                }

                foreach (var keyword in GConsole.Instance.Keywords)
                {
                    var resultSecond = ParsingHelpers.AutoCompleteString(line.Substring(result.RemainderStartPosition - 1), keyword.Name);
                    if (resultSecond.WasSuccessful == AutoCompletionResultType.SuccessOneOption)
                    {
                        var finalResult = new AutoCompletionResult();
                        finalResult.WasSuccessful = AutoCompletionResultType.SuccessOneOption;
                        finalResult.Results.Add(line.Substring(0, result.RemainderStartPosition - 1) + " " + resultSecond.Results[0]);
                        return(finalResult);
                    }
                }
            }

            return(result);
        }
Beispiel #2
0
 public AutoCompletionResult AutoComplete(string line)
 {
     return(ParsingHelpers.AutoCompleteCommandBody(line, this));
 }