mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix: IDEA-56520 (TODOs in gsp files should be highlighted in blue on the scrollbar)
This commit is contained in:
@@ -18,11 +18,9 @@ package com.intellij.psi.impl.search;
|
||||
import com.intellij.lang.LanguageParserDefinitions;
|
||||
import com.intellij.lang.ParserDefinition;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.lexer.LexerBase;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
|
||||
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory;
|
||||
import com.intellij.openapi.editor.highlighter.HighlighterIterator;
|
||||
import com.intellij.openapi.editor.impl.DocumentImpl;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -33,7 +31,6 @@ import com.intellij.psi.jsp.JspFile;
|
||||
import com.intellij.psi.jsp.JspTokenType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.util.text.CharSequenceSubSequence;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -79,58 +76,4 @@ public class JspIndexPatternBuilder implements IndexPatternBuilder {
|
||||
public int getCommentEndDelta(final IElementType tokenType) {
|
||||
return tokenType == JspTokenType.JSP_COMMENT ? "--%>".length() : 0;
|
||||
}
|
||||
|
||||
private static class LexerEditorHighlighterLexer extends LexerBase {
|
||||
HighlighterIterator iterator;
|
||||
CharSequence buffer;
|
||||
int start;
|
||||
int end;
|
||||
private final EditorHighlighter myHighlighter;
|
||||
private final boolean myAlreadyInitializedHighlighter;
|
||||
|
||||
public LexerEditorHighlighterLexer(final EditorHighlighter highlighter, boolean alreadyInitializedHighlighter) {
|
||||
myHighlighter = highlighter;
|
||||
myAlreadyInitializedHighlighter = alreadyInitializedHighlighter;
|
||||
}
|
||||
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int state) {
|
||||
if (myAlreadyInitializedHighlighter) {
|
||||
this.buffer = buffer;
|
||||
start = startOffset;
|
||||
end = endOffset;
|
||||
} else {
|
||||
myHighlighter.setText(new CharSequenceSubSequence(this.buffer = buffer, start = startOffset, end = endOffset));
|
||||
}
|
||||
iterator = myHighlighter.createIterator(0);
|
||||
}
|
||||
|
||||
public int getState() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public IElementType getTokenType() {
|
||||
if (iterator.atEnd()) return null;
|
||||
return iterator.getTokenType();
|
||||
}
|
||||
|
||||
public int getTokenStart() {
|
||||
return iterator.getStart();
|
||||
}
|
||||
|
||||
public int getTokenEnd() {
|
||||
return iterator.getEnd();
|
||||
}
|
||||
|
||||
public void advance() {
|
||||
iterator.advance();
|
||||
}
|
||||
|
||||
public CharSequence getBufferSequence() {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public int getBufferEnd() {
|
||||
return end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.lexer.LexerBase;
|
||||
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
|
||||
import com.intellij.openapi.editor.highlighter.HighlighterIterator;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.text.CharSequenceSubSequence;
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
*/
|
||||
public class LexerEditorHighlighterLexer extends LexerBase {
|
||||
HighlighterIterator iterator;
|
||||
CharSequence buffer;
|
||||
int start;
|
||||
int end;
|
||||
private final EditorHighlighter myHighlighter;
|
||||
private final boolean myAlreadyInitializedHighlighter;
|
||||
|
||||
public LexerEditorHighlighterLexer(final EditorHighlighter highlighter, boolean alreadyInitializedHighlighter) {
|
||||
myHighlighter = highlighter;
|
||||
myAlreadyInitializedHighlighter = alreadyInitializedHighlighter;
|
||||
}
|
||||
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int state) {
|
||||
if (myAlreadyInitializedHighlighter) {
|
||||
this.buffer = buffer;
|
||||
start = startOffset;
|
||||
end = endOffset;
|
||||
} else {
|
||||
myHighlighter.setText(new CharSequenceSubSequence(this.buffer = buffer, start = startOffset, end = endOffset));
|
||||
}
|
||||
iterator = myHighlighter.createIterator(0);
|
||||
}
|
||||
|
||||
public int getState() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public IElementType getTokenType() {
|
||||
if (iterator.atEnd()) return null;
|
||||
return iterator.getTokenType();
|
||||
}
|
||||
|
||||
public int getTokenStart() {
|
||||
return iterator.getStart();
|
||||
}
|
||||
|
||||
public int getTokenEnd() {
|
||||
return iterator.getEnd();
|
||||
}
|
||||
|
||||
public void advance() {
|
||||
iterator.advance();
|
||||
}
|
||||
|
||||
public CharSequence getBufferSequence() {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public int getBufferEnd() {
|
||||
return end;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user