mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix completion in an empty custom-file-type file (EA-93679 - IOOBE: SegmentArrayWithData.getSegmentData)
This commit is contained in:
+6
@@ -42,6 +42,12 @@ public class CustomFileTypeCompletionTest extends LightCompletionTestCase {
|
||||
testByCount(0, new String[] { null });
|
||||
}
|
||||
|
||||
public void testEmptyFile() throws Throwable {
|
||||
configureFromFileText("a.cs", "<caret>");
|
||||
complete();
|
||||
testByCount(1, "abstract", "x");
|
||||
}
|
||||
|
||||
public void testPlainTextSubstitution() throws IOException {
|
||||
FileTypeManagerEx.getInstanceEx().registerFileType(MockLanguageFileType.INSTANCE, "xxx");
|
||||
try {
|
||||
|
||||
+2
@@ -71,6 +71,8 @@ public class CustomFileTypeCompletionContributor extends CompletionContributor i
|
||||
|
||||
private static boolean inCommentOrLiteral(CompletionParameters parameters) {
|
||||
HighlighterIterator iterator = ((EditorEx)parameters.getEditor()).getHighlighter().createIterator(parameters.getOffset());
|
||||
if (iterator.atEnd()) return false;
|
||||
|
||||
IElementType elementType = iterator.getTokenType();
|
||||
if (elementType == CustomHighlighterTokenType.WHITESPACE) {
|
||||
iterator.retreat();
|
||||
|
||||
Reference in New Issue
Block a user