mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
no more word completion autopopup, even in plain text (IDEA-64781)
This commit is contained in:
@@ -32,11 +32,6 @@ public class JavaWordCompletionFilter implements WordCompletionElementFilter {
|
||||
JavaDocTokenType.DOC_COMMENT_DATA, JavaTokenType.STRING_LITERAL);
|
||||
|
||||
public boolean isWordCompletionEnabledIn(final IElementType element) {
|
||||
final CompletionProcess process = CompletionService.getCompletionService().getCurrentCompletion();
|
||||
if (process != null && process.isAutopopupCompletion()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ENABLED_TOKENS.contains(element);
|
||||
}
|
||||
}
|
||||
@@ -25,11 +25,6 @@ import com.intellij.psi.tree.IElementType;
|
||||
|
||||
public class DefaultWordCompletionFilter implements WordCompletionElementFilter {
|
||||
public boolean isWordCompletionEnabledIn(final IElementType element) {
|
||||
final CompletionProcess process = CompletionService.getCompletionService().getCurrentCompletion();
|
||||
if (process != null && process.isAutopopupCompletion()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(element.getLanguage());
|
||||
return parserDefinition != null && parserDefinition.getCommentTokens().contains(element);
|
||||
}
|
||||
|
||||
+5
-18
@@ -19,7 +19,6 @@ import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.LanguageWordCompletion;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.psi.PlainTextTokenTypes;
|
||||
@@ -71,6 +70,10 @@ public class WordCompletionContributor extends CompletionContributor implements
|
||||
return true;
|
||||
}
|
||||
|
||||
if (parameters.getInvocationCount() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final PsiFile file = insertedElement.getContainingFile();
|
||||
final CompletionData data = CompletionUtil.getCompletionDataByElement(insertedElement, file);
|
||||
if (data != null && !(data instanceof SyntaxTableCompletionData)) {
|
||||
@@ -95,8 +98,7 @@ public class WordCompletionContributor extends CompletionContributor implements
|
||||
ASTNode textContainer = element != null ? element.getNode() : null;
|
||||
while (textContainer != null) {
|
||||
final IElementType elementType = textContainer.getElementType();
|
||||
if (LanguageWordCompletion.INSTANCE.isEnabledIn(elementType) ||
|
||||
isPlainText(parameters, elementType)) {
|
||||
if (LanguageWordCompletion.INSTANCE.isEnabledIn(elementType) || elementType == PlainTextTokenTypes.PLAIN_TEXT) {
|
||||
return true;
|
||||
}
|
||||
textContainer = textContainer.getTreeParent();
|
||||
@@ -104,19 +106,4 @@ public class WordCompletionContributor extends CompletionContributor implements
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isPlainText(CompletionParameters parameters, IElementType elementType) {
|
||||
if (elementType != PlainTextTokenTypes.PLAIN_TEXT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (parameters.getInvocationCount() > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return parameters.getOriginalFile().getViewProvider().getVirtualFile().isInLocalFileSystem();
|
||||
}
|
||||
}
|
||||
|
||||
-5
@@ -27,11 +27,6 @@ import com.intellij.psi.tree.IElementType;
|
||||
|
||||
public class PropertiesWordCompletionFilter extends DefaultWordCompletionFilter {
|
||||
public boolean isWordCompletionEnabledIn(final IElementType element) {
|
||||
final CompletionProcess process = CompletionService.getCompletionService().getCurrentCompletion();
|
||||
if (process != null && process.isAutopopupCompletion()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.isWordCompletionEnabledIn(element) || element == PropertiesElementTypes.PROPERTY;
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,6 @@ public class XmlWordCompletionFilter extends DefaultWordCompletionFilter {
|
||||
XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN,
|
||||
XmlTokenType.XML_DATA_CHARACTERS);
|
||||
public boolean isWordCompletionEnabledIn(final IElementType element) {
|
||||
final CompletionProcess process = CompletionService.getCompletionService().getCurrentCompletion();
|
||||
if (process != null && process.isAutopopupCompletion()) {
|
||||
return false;
|
||||
}
|
||||
return super.isWordCompletionEnabledIn(element) || ENABLED_TOKENS.contains(element);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user