congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
HighlighterIterator.retreat
Code IndexAdd Tabnine to your IDE (free)

How to use
retreat
method
in
com.intellij.openapi.editor.highlighter.HighlighterIterator

Best Java code snippets using com.intellij.openapi.editor.highlighter.HighlighterIterator.retreat (Showing top 7 results out of 315)

origin: KronicDeth/intellij-elixir

 @Nullable
 @Override
 public BracePair findPair(boolean left, HighlighterIterator iterator, CharSequence fileText, FileType fileType) {
  BracePair pair = super.findPair(left, iterator, fileText, fileType);

  if (pair == Paired.DO_END || pair == Paired.FN_END) {
   iterator.advance();

   if (!iterator.atEnd()) {
    IElementType tokenType = iterator.getTokenType();

    if (tokenType == ElixirTypes.KEYWORD_PAIR_COLON) {
     pair = null;
    }
   }

   iterator.retreat();
  }

  return pair;
 }
}
origin: KronicDeth/intellij-elixir

@Nullable
@Override
public CharSequence getClosingQuote(HighlighterIterator highlighterIterator, int offset) {
  CharSequence closingQuote = null;
  if (highlighterIterator.getStart() > 0) {
    highlighterIterator.retreat();
    try {
      IElementType tokenType = highlighterIterator.getTokenType();
      if (CLOSING_QUOTE_BY_OPENING_QUOTE.get(tokenType) != null) {
        Document document = highlighterIterator.getDocument();
        if (document != null) {
          String promoter = document.getText(
              new TextRange(highlighterIterator.getStart(), highlighterIterator.getEnd())
          );
          String terminator = StackFrame.TERMINATOR_BY_PROMOTER.get(promoter);
          if (terminator != null) {
            if (terminator.length() >= 3) {
              closingQuote = "\n" + terminator;
            } else {
              closingQuote = terminator;
            }
          }
        }
      }
    } finally {
      highlighterIterator.advance();
    }
  }
  return closingQuote;
}
origin: Camelcade/Perl5-IDEA

/**
 * Iterates back until atEnd or non-space token
 */
@NotNull
public static HighlighterIterator moveToPreviousMeaningfulToken(@NotNull HighlighterIterator iterator) {
 while (!iterator.atEnd()) {
  IElementType tokenType = iterator.getTokenType();
  if (tokenType != TokenType.WHITE_SPACE) {
   break;
  }
  iterator.retreat();
 }
 return iterator;
}
origin: halirutan/Mathematica-IntelliJ-Plugin

@Nullable
private IElementType getNonWhitespaceElementType(final HighlighterIterator iterator, int curLineStart, final int prevLineStartOffset) {
 while (!iterator.atEnd() && iterator.getEnd() >= curLineStart && iterator.getStart() >= prevLineStartOffset) {
  final IElementType tokenType = iterator.getTokenType();
  if (!MathematicaElementTypes.WHITE_SPACE_OR_COMMENTS.contains(tokenType)) {
   return tokenType;
  }
  iterator.retreat();
 }
 return null;
}
origin: halirutan/Mathematica-IntelliJ-Plugin

@Nullable
private IElementType getNonWhitespaceElementType(final HighlighterIterator iterator, int curLineStart, final int prevLineStartOffset) {
 while (!iterator.atEnd() && iterator.getEnd() >= curLineStart && iterator.getStart() >= prevLineStartOffset) {
  final IElementType tokenType = iterator.getTokenType();
  if (!MathematicaElementTypes.WHITE_SPACE_OR_COMMENTS.contains(tokenType)) {
   return tokenType;
  }
  iterator.retreat();
 }
 return null;
}
origin: Camelcade/Perl5-IDEA

 @Nullable
 @Contract("null -> null")
 public static IElementType getLastOpenMarker(@Nullable Editor editor) {
  if (editor == null) {
   return null;
  }
  int offset = editor.getCaretModel().getOffset();
  HighlighterIterator iterator = ((EditorEx)editor).getHighlighter().createIterator(offset);

  while (!iterator.atEnd()) {
   IElementType tokenType = iterator.getTokenType();
   if (TemplateToolkitSyntaxElements.OPEN_TAGS.contains(tokenType)) {
    return tokenType;
   }
   iterator.retreat();
  }

  return null;
 }
}
origin: qeesung/HighlightBracketPair

int initOffset = iterator.atEnd() ? -1 : iterator.getStart();
Stack<IElementType> braceStack = new Stack<>();
for (; !iterator.atEnd(); iterator.retreat()) {
  final IElementType tokenType = iterator.getTokenType();
com.intellij.openapi.editor.highlighterHighlighterIteratorretreat

Popular methods of HighlighterIterator

  • atEnd
  • getTokenType
  • advance
  • getEnd
  • getStart
  • getDocument
  • getTextAttributes

Popular in Java

  • Making http requests using okhttp
  • requestLocationUpdates (LocationManager)
  • getContentResolver (Context)
  • startActivity (Activity)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now