mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
sometimes the best assertion fix is to remove the assertion (EA-36471)
This commit is contained in:
-13
@@ -100,19 +100,6 @@ public class FilePathCompletionContributor extends CompletionContributor {
|
||||
final FileReferenceSet set = first.getFileReferenceSet();
|
||||
String prefix = set.getPathString()
|
||||
.substring(0, parameters.getOffset() - set.getElement().getTextRange().getStartOffset() - set.getStartInElement());
|
||||
final String textBeforePosition = e.getContainingFile().getText().substring(0, parameters.getOffset());
|
||||
if (!textBeforePosition.endsWith(prefix)) {
|
||||
final int len = textBeforePosition.length();
|
||||
final String fragment = len > 100 ? textBeforePosition.substring(len - 100) : textBeforePosition;
|
||||
throw new AssertionError("prefix should be some actual file string just before caret: " +
|
||||
prefix +
|
||||
"\n text=" +
|
||||
fragment +
|
||||
";\npathString=" +
|
||||
set.getPathString() +
|
||||
";\nelementText=" +
|
||||
e.getParent().getText());
|
||||
}
|
||||
|
||||
List<String> pathPrefixParts = null;
|
||||
int lastSlashIndex;
|
||||
|
||||
-11
@@ -27,11 +27,9 @@ import com.intellij.openapi.project.ProjectManagerAdapter;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.patterns.ElementPattern;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.Weigher;
|
||||
import com.intellij.psi.WeighingService;
|
||||
import com.intellij.psi.impl.DebugUtil;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.intellij.util.Consumer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -135,15 +133,6 @@ public class CompletionServiceImpl extends CompletionService{
|
||||
|
||||
@NotNull
|
||||
public CompletionResultSet withPrefixMatcher(@NotNull final PrefixMatcher matcher) {
|
||||
if (!myTextBeforePosition.endsWith(matcher.getPrefix())) {
|
||||
final int len = myTextBeforePosition.length();
|
||||
final String fragment = len > 100 ? myTextBeforePosition.substring(len - 100) : myTextBeforePosition;
|
||||
PsiFile positionFile = myParameters.getPosition().getContainingFile();
|
||||
LOG.error("prefix should be some actual file string just before caret: " + matcher.getPrefix() +
|
||||
"\n text=" + fragment +
|
||||
"\ninjected=" + (InjectedLanguageUtil.getTopLevelFile(positionFile) != positionFile) +
|
||||
"\nlang=" + positionFile.getLanguage());
|
||||
}
|
||||
return new CompletionResultSetImpl(getConsumer(), myTextBeforePosition, matcher, myContributor, myParameters, mySorter, myProcess, this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user