Search in sources :

Example 1 with SingleCharSequence

use of com.intellij.util.text.SingleCharSequence in project intellij-community by JetBrains.

the class LexerEditorHighlighter method getAttributesForPreviousAndTypedChars.

@NotNull
public List<TextAttributes> getAttributesForPreviousAndTypedChars(@NotNull Document document, int offset, char c) {
    final CharSequence text = document.getImmutableCharSequence();
    final CharSequence newText = new MergingCharSequence(new MergingCharSequence(text.subSequence(0, offset), new SingleCharSequence(c)), text.subSequence(offset, text.length()));
    final List<IElementType> tokenTypes = getTokenType(newText, offset);
    return Arrays.asList(getAttributes(tokenTypes.get(0)).clone(), getAttributes(tokenTypes.get(1)).clone());
}
Also used : SingleCharSequence(com.intellij.util.text.SingleCharSequence) IElementType(com.intellij.psi.tree.IElementType) SingleCharSequence(com.intellij.util.text.SingleCharSequence) MergingCharSequence(com.intellij.util.text.MergingCharSequence) ImmutableCharSequence(com.intellij.util.text.ImmutableCharSequence) MergingCharSequence(com.intellij.util.text.MergingCharSequence) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

IElementType (com.intellij.psi.tree.IElementType)1 ImmutableCharSequence (com.intellij.util.text.ImmutableCharSequence)1 MergingCharSequence (com.intellij.util.text.MergingCharSequence)1 SingleCharSequence (com.intellij.util.text.SingleCharSequence)1 NotNull (org.jetbrains.annotations.NotNull)1