congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
HighlighterIterator.advance
Code IndexAdd Tabnine to your IDE (free)

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

Best Java code snippets using com.intellij.openapi.editor.highlighter.HighlighterIterator.advance (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 forward until atEnd or non-space token
 */
@NotNull
public static HighlighterIterator moveToNextMeaningfulToken(@NotNull HighlighterIterator iterator) {
 iterator.advance();
 while (!iterator.atEnd()) {
  IElementType tokenType = iterator.getTokenType();
  if (tokenType != TokenType.WHITE_SPACE) {
   break;
  }
  iterator.advance();
 }
 return iterator;
}
origin: Camelcade/Perl5-IDEA

 return true;
highlighterIterator.advance();
origin: qeesung/HighlightBracketPair

int initOffset = iterator.atEnd() ? -1 : iterator.getStart();
Stack<IElementType> braceStack = new Stack<>();
for (; !iterator.atEnd(); iterator.advance()) {
  final IElementType tokenType = iterator.getTokenType();
origin: Camelcade/Perl5-IDEA

iterator.advance();
IElementType possibleCloseQuoteType = iterator.atEnd() ? null : iterator.getTokenType();
if (QUOTE_CLOSE_FIRST_ANY.contains(possibleCloseQuoteType) && closeChar == text.charAt(iterator.getStart())) {
 if (COMPLEX_QUOTE_OPENERS.contains(quotePrefixType) && StringUtil.containsChar(HANDLED_BY_BRACE_MATCHER, openChar)) {
  iterator.advance();
  if (iterator.atEnd() || !QUOTE_OPEN_ANY.contains(iterator.getTokenType())) {
   EditorModificationUtil.insertStringAtCaret(editor, Character.toString(closeChar) + openChar, false, false);
origin: BashSupport/BashSupport

protected void doLexerHighlightingTest(String fileContent, IElementType targetElementType) {
  BashSyntaxHighlighter syntaxHighlighter = new BashSyntaxHighlighter();
  TextAttributesKey[] keys = syntaxHighlighter.getTokenHighlights(targetElementType);
  Assert.assertEquals("Expected one key", 1, keys.length);
  TextAttributesKey attributesKey = keys[0];
  Assert.assertNotNull(attributesKey);
  EditorColorsManager manager = EditorColorsManager.getInstance();
  EditorColorsScheme scheme = (EditorColorsScheme) manager.getGlobalScheme().clone();
  manager.addColorsScheme(scheme);
  EditorColorsManager.getInstance().setGlobalScheme(scheme);
  TextAttributes targetAttributes = new TextAttributes(JBColor.RED, JBColor.BLUE, JBColor.GRAY, EffectType.BOXED, Font.BOLD);
  scheme.setAttributes(attributesKey, targetAttributes);
  myFixture.configureByText(BashFileType.BASH_FILE_TYPE, fileContent);
  TextAttributes actualAttributes = null;
  HighlighterIterator iterator = ((EditorImpl) myFixture.getEditor()).getHighlighter().createIterator(0);
  while (!iterator.atEnd()) {
    if (iterator.getTokenType() == targetElementType) {
      actualAttributes = iterator.getTextAttributes();
      break;
    }
    iterator.advance();
  }
  Assert.assertEquals("Expected text attributes for " + attributesKey, targetAttributes, actualAttributes);
}
com.intellij.openapi.editor.highlighterHighlighterIteratoradvance

Popular methods of HighlighterIterator

  • atEnd
  • getTokenType
  • retreat
  • getEnd
  • getStart
  • getDocument
  • getTextAttributes

Popular in Java

  • Running tasks concurrently on multiple threads
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getApplicationContext (Context)
  • getSupportFragmentManager (FragmentActivity)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • BoxLayout (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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