public TextSpan GetPreviousSpanFor(TextSpan span) { if (span.Start == 0) return new TextSpan(span.Snapshot, 0, 0); return GetSpanFor(span.Start - 1, span.Snapshot); }
public TextSpan GetNextSpanFor(TextSpan span) { if (span.End == span.Snapshot.Length) return new TextSpan(span.Snapshot, span.Snapshot.Length, 0); return GetSpanFor(span.End, span.Snapshot); }
private IClassification ClassificationFor(Token token, TextSpan textSpan) { switch (token.Type) { case TokenType.WhiteSpace: return _standardClassificationRegistry.WhiteSpace; case TokenType.Identifier: return _keywords.Contains(textSpan.Text) ? _standardClassificationRegistry.Keyword : _standardClassificationRegistry.Identifier; case TokenType.Punctuation: return _standardClassificationRegistry.Punctuation; case TokenType.Number: return _standardClassificationRegistry.Number; case TokenType.None: return _standardClassificationRegistry.Operator; default: throw new ArgumentOutOfRangeException(); } }
public ICompletionSet CompletionsFor(TextSpan contextForCompletion) { return new CompletionSet(UnityScriptClassifier.Keywords.Select(kw => (ICompletion)new Completion(kw))); }
public void StartCompletionSession(TextSpan completionSpan, ICompletionSet completions) { _codeView.StartCompletionSession(new CompletionSession(completionSpan, completions)); }
private ClassificationSpan Identifier(TextSpan textSpan) { return Identifier(textSpan.Span.Start, textSpan.Span.Length); }
private ClassificationSpan Comment(TextSpan textSpan) { return new ClassificationSpan(ClassificationRegistry.Comment, textSpan); }
public CompletionSession(TextSpan completionSpan, ICompletionSet completions) { _completions = completions; }
public ICompletionSet CompletionsFor(TextSpan contextForCompletion) { return new CompletionSet(new Completion[0]); }
private IEnumerable<ClassificationSpan> ClassificationsFor(TextSpan textSpan) { return _tokenizer.Tokenize(textSpan.Text).Select(t => ClassificationSpanFor(t, textSpan.Snapshot, textSpan.Span.Start)); }
public ClassificationSpan(IClassification classification, TextSpan span) { Classification = classification; Span = span; }
private ICompletionSet CompletionsFor(TextSpan newTextSpan) { return _completionProvider.CompletionsFor(newTextSpan); }