public Task <ExecutionResult> Execute(IInteractiveWindow window, string arguments) { var engine = window.Evaluator as InteractiveEvaluator; if (engine != null) { int i = 0; string path; if (!CommandArgumentsParser.ParsePath(arguments, ref i, out path) || path == null) { ReportInvalidArguments(window); return(ExecutionResult.Failed); } if (!CommandArgumentsParser.ParseTrailingTrivia(arguments, ref i)) { window.ErrorOutputWriter.WriteLine(string.Format(EditorFeaturesResources.UnexpectedText, arguments.Substring(i))); return(ExecutionResult.Failed); } return(engine.LoadCommandAsync(path)); } return(ExecutionResult.Failed); }
public IEnumerable <ClassificationSpan> ClassifyArguments(ITextSnapshot snapshot, Span argumentsSpan, Span spanToClassify) { string path; var arguments = snapshot.GetText(); int i = argumentsSpan.Start; int start, end; CommandArgumentsParser.ParsePath(arguments, ref i, out path, out start, out end); if (end > start) { yield return(new ClassificationSpan(new SnapshotSpan(snapshot, Span.FromBounds(start, end)), _registry.StringLiteral)); } CommandArgumentsParser.ParseTrailingTrivia(arguments, ref i, out start, out end); if (end > start) { yield return(new ClassificationSpan(new SnapshotSpan(snapshot, Span.FromBounds(start, end)), _registry.Comment)); } }