mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
WordCompletionContributor: don't fail when invoked before literal value start (EA-144730) and don't allocate huge strings
GitOrigin-RevId: f09241ba70c15877a7aa3e15267ebbe8baa99eae
This commit is contained in:
committed by
intellij-monorepo-bot
parent
402d7036e6
commit
de144ef6a0
+5
-2
@@ -100,9 +100,12 @@ public class WordCompletionContributor extends CompletionContributor implements
|
||||
if (manipulator == null) {
|
||||
return;
|
||||
}
|
||||
int offset = manipulator.getRangeInElement(localString).getStartOffset();
|
||||
int valueStart = manipulator.getRangeInElement(localString).getStartOffset() + localString.getTextRange().getStartOffset();
|
||||
if (valueStart > parameters.getOffset()) {
|
||||
return;
|
||||
}
|
||||
PsiFile file = position.getContainingFile();
|
||||
String prefix = file.getText().substring(offset + localString.getTextRange().getStartOffset(), parameters.getOffset());
|
||||
String prefix = file.getViewProvider().getContents().subSequence(valueStart, parameters.getOffset()).toString();
|
||||
CompletionResultSet fullStringResult = result.withPrefixMatcher(new PlainPrefixMatcher(prefix));
|
||||
file.accept(new PsiRecursiveElementWalkingVisitor() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user