mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Move part of lang to analysis and get rid of python-psi-impl dependency on lang
GitOrigin-RevId: 0e6673894d5c1305ccf3992ae585186d00317533
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ebae81428c
commit
5803455d10
@@ -7,6 +7,7 @@ import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.codeInsight.completion.JavaMethodCallElement;
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.LambdaHighlightingUtil;
|
||||
import com.intellij.codeInsight.hints.ParameterHintsPass;
|
||||
import com.intellij.codeInsight.lookup.CommaTailType;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -1132,7 +1133,7 @@ public class ExpectedTypesProvider {
|
||||
PsiCall completedOuterCall = getCompletedOuterCall(argument);
|
||||
if (completedOuterCall != null) return new CommaTailTypeWithSyncHintUpdate(completedOuterCall);
|
||||
}
|
||||
return TailType.COMMA;
|
||||
return CommaTailType.INSTANCE;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1383,12 +1384,12 @@ public class ExpectedTypesProvider {
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull InsertionContext context) {
|
||||
return TailType.COMMA.isApplicable(context);
|
||||
return CommaTailType.INSTANCE.isApplicable(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int processTail(Editor editor, int tailOffset) {
|
||||
int result = TailType.COMMA.processTail(editor, tailOffset);
|
||||
int result = CommaTailType.INSTANCE.processTail(editor, tailOffset);
|
||||
if (myOriginalCall.isValid()) {
|
||||
PsiDocumentManager.getInstance(myOriginalCall.getProject()).commitDocument(editor.getDocument());
|
||||
if (myOriginalCall.isValid()) ParameterHintsPass.syncUpdate(myOriginalCall, editor);
|
||||
|
||||
@@ -133,7 +133,7 @@ public class AllClassesGetter {
|
||||
}
|
||||
return true;
|
||||
});
|
||||
LinkedHashSet<String> sorted = CompletionUtil.sortMatching(prefixMatcher, names);
|
||||
LinkedHashSet<String> sorted = prefixMatcher.sortMatching(names);
|
||||
AllClassesSearchExecutor.processClassesByNames(project, scope, sorted, processor);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.codeInsight.completion.util.CompletionStyleUtil;
|
||||
import com.intellij.codeInsight.lookup.*;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.ClassConditionKey;
|
||||
@@ -52,7 +53,7 @@ public class CastingLookupElementDecorator extends LookupElementDecorator<Lookup
|
||||
|
||||
@Override
|
||||
public void handleInsert(@NotNull InsertionContext context) {
|
||||
final CommonCodeStyleSettings settings = context.getCodeStyleSettings();
|
||||
final CommonCodeStyleSettings settings = CompletionStyleUtil.getCodeStyleSettings(context);
|
||||
String spaceWithin = settings.SPACE_WITHIN_CAST_PARENTHESES ? " " : "";
|
||||
String spaceAfter = settings.SPACE_AFTER_TYPE_CAST ? " " : "";
|
||||
final Editor editor = context.getEditor();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.codeInsight.AutoPopupController;
|
||||
import com.intellij.codeInsight.CharTailType;
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.*;
|
||||
import com.intellij.codeInsight.lookup.CommaTailType;
|
||||
import com.intellij.codeInsight.lookup.EqTailType;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupItem;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -37,9 +37,9 @@ public class DefaultInsertHandler implements InsertHandler {
|
||||
private static TailType getTailType(final char completionChar, LookupItem item){
|
||||
switch(completionChar){
|
||||
case '.': return new CharTailType('.', false);
|
||||
case ',': return TailType.COMMA;
|
||||
case ',': return CommaTailType.INSTANCE;
|
||||
case ';': return TailType.SEMICOLON;
|
||||
case '=': return TailType.EQ;
|
||||
case '=': return EqTailType.INSTANCE;
|
||||
case ' ': return TailType.SPACE;
|
||||
case ':': return TailType.CASE_COLON; //?
|
||||
case '<':
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ public class JavaClassNameCompletionContributor extends CompletionContributor {
|
||||
consumer.consume(item);
|
||||
return true;
|
||||
});
|
||||
for (String name : CompletionUtil.sortMatching(matcher, annoMap.keySet())) {
|
||||
for (String name : matcher.sortMatching(annoMap.keySet())) {
|
||||
if (!ContainerUtil.process(annoMap.get(name), processor)) break;
|
||||
}
|
||||
return;
|
||||
|
||||
+4
-7
@@ -1,10 +1,7 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.codeInsight.ExpectedTypeInfo;
|
||||
import com.intellij.codeInsight.ExpectedTypesProvider;
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.TailTypes;
|
||||
import com.intellij.codeInsight.*;
|
||||
import com.intellij.codeInsight.completion.scope.JavaCompletionProcessor;
|
||||
import com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFix;
|
||||
import com.intellij.codeInsight.lookup.*;
|
||||
@@ -626,7 +623,7 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
@Override
|
||||
public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) {
|
||||
final Editor editor = context.getEditor();
|
||||
TailType.EQ.processTail(editor, editor.getCaretModel().getOffset());
|
||||
EqTailType.INSTANCE.processTail(editor, editor.getCaretModel().getOffset());
|
||||
context.setAddCompletionChar(false);
|
||||
|
||||
context.commitDocument();
|
||||
@@ -635,7 +632,7 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
if (paramList != null && paramList.getAttributes().length > 0 && paramList.getAttributes()[0].getName() == null) {
|
||||
int valueOffset = paramList.getAttributes()[0].getTextRange().getStartOffset();
|
||||
context.getDocument().insertString(valueOffset, PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME);
|
||||
TailType.EQ.processTail(editor, valueOffset + PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME.length());
|
||||
EqTailType.INSTANCE.processTail(editor, valueOffset + PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME.length());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1026,4 +1023,4 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.intellij.codeInsight.*;
|
||||
import com.intellij.codeInsight.completion.impl.CamelHumpMatcher;
|
||||
import com.intellij.codeInsight.completion.scope.CompletionElement;
|
||||
import com.intellij.codeInsight.completion.scope.JavaCompletionProcessor;
|
||||
import com.intellij.codeInsight.completion.util.CompletionStyleUtil;
|
||||
import com.intellij.codeInsight.completion.util.ParenthesesInsertHandler;
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.LambdaHighlightingUtil;
|
||||
import com.intellij.codeInsight.editorActions.TabOutScopesTracker;
|
||||
@@ -418,7 +419,7 @@ public class JavaCompletionUtil {
|
||||
if (ref != null) {
|
||||
final PsiElement qualifier = ref.getQualifier();
|
||||
if (qualifier != null) {
|
||||
final CommonCodeStyleSettings settings = context.getCodeStyleSettings();
|
||||
final CommonCodeStyleSettings settings = CompletionStyleUtil.getCodeStyleSettings(context);
|
||||
|
||||
final String parenSpace = settings.SPACE_WITHIN_PARENTHESES ? " " : "";
|
||||
document.insertString(qualifier.getTextRange().getEndOffset(), parenSpace + ")");
|
||||
@@ -768,7 +769,7 @@ public class JavaCompletionUtil {
|
||||
|
||||
context.commitDocument();
|
||||
|
||||
final CommonCodeStyleSettings styleSettings = context.getCodeStyleSettings();
|
||||
final CommonCodeStyleSettings styleSettings = CompletionStyleUtil.getCodeStyleSettings(context);
|
||||
final PsiElement elementAt = file.findElementAt(context.getStartOffset());
|
||||
if (elementAt == null || !(elementAt.getParent() instanceof PsiMethodReferenceExpression)) {
|
||||
final boolean hasParameters = hasParams;
|
||||
@@ -970,4 +971,4 @@ public class JavaCompletionUtil {
|
||||
}
|
||||
return start + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.intellij.codeInsight.completion;
|
||||
import com.intellij.codeInsight.ExpectedTypeInfo;
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.TailTypes;
|
||||
import com.intellij.codeInsight.completion.util.CompletionStyleUtil;
|
||||
import com.intellij.codeInsight.completion.util.ParenthesesInsertHandler;
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.HighlightUtil;
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.LambdaHighlightingUtil;
|
||||
@@ -522,7 +523,7 @@ public class JavaKeywordCompletion {
|
||||
PsiInstanceOfExpression expr =
|
||||
PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), context.getStartOffset(), PsiInstanceOfExpression.class, false);
|
||||
if (expr != null) {
|
||||
String space = context.getCodeStyleSettings().SPACE_WITHIN_PARENTHESES ? " " : "";
|
||||
String space = CompletionStyleUtil.getCodeStyleSettings(context).SPACE_WITHIN_PARENTHESES ? " " : "";
|
||||
context.getDocument().insertString(expr.getTextRange().getStartOffset(), "!(" + space);
|
||||
context.getDocument().insertString(context.getTailOffset(), space + ")");
|
||||
}
|
||||
@@ -923,4 +924,4 @@ public class JavaKeywordCompletion {
|
||||
return context.shouldAddCompletionChar() ? TailType.NONE : myTail;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.intellij.codeInsight.ExpectedTypeInfoImpl;
|
||||
import com.intellij.codeInsight.ExpectedTypesProvider;
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.completion.simple.RParenthTailType;
|
||||
import com.intellij.codeInsight.completion.util.CompletionStyleUtil;
|
||||
import com.intellij.codeInsight.guess.GuessManager;
|
||||
import com.intellij.codeInsight.lookup.AutoCompletionPolicy;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
@@ -177,7 +178,7 @@ class SmartCastProvider extends CompletionProvider<CompletionParameters> {
|
||||
context.getOffsetMap().getOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET));
|
||||
}
|
||||
|
||||
final CommonCodeStyleSettings csSettings = context.getCodeStyleSettings();
|
||||
final CommonCodeStyleSettings csSettings = CompletionStyleUtil.getCodeStyleSettings(context);
|
||||
final int oldTail = context.getTailOffset();
|
||||
context.setTailOffset(RParenthTailType.addRParenth(editor, oldTail, csSettings.SPACE_WITHIN_CAST_PARENTHESES));
|
||||
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ public class SmartCompletionDecorator extends LookupElementDecorator<LookupEleme
|
||||
}
|
||||
TailTypeDecorator.withTail(getDelegate(), tailType).handleInsert(context);
|
||||
|
||||
if (tailType == TailType.COMMA) {
|
||||
if (tailType == CommaTailType.INSTANCE) {
|
||||
AutoPopupController.getInstance(context.getProject()).autoPopupParameterInfo(context.getEditor(), null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public abstract class StaticMemberProcessor {
|
||||
public void processStaticMethodsGlobally(final PrefixMatcher matcher, Consumer<? super LookupElement> consumer) {
|
||||
final GlobalSearchScope scope = myPosition.getResolveScope();
|
||||
Collection<String> memberNames = JavaStaticMemberNameIndex.getInstance().getAllKeys(myProject);
|
||||
for (final String memberName : CompletionUtil.sortMatching(matcher, memberNames)) {
|
||||
for (final String memberName : matcher.sortMatching(memberNames)) {
|
||||
Set<PsiClass> classes = new THashSet<>();
|
||||
for (final PsiMember member : JavaStaticMemberNameIndex.getInstance().getStaticMembers(memberName, myProject, scope)) {
|
||||
if (isStaticallyImportable(member)) {
|
||||
|
||||
+2
-5
@@ -3,10 +3,7 @@ package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.codeInsight.*;
|
||||
import com.intellij.codeInsight.completion.util.ParenthesesInsertHandler;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementPresentation;
|
||||
import com.intellij.codeInsight.lookup.PsiTypeLookupItem;
|
||||
import com.intellij.codeInsight.lookup.TailTypeDecorator;
|
||||
import com.intellij.codeInsight.lookup.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -123,7 +120,7 @@ class TypeArgumentCompletionProvider extends CompletionProvider<CompletionParame
|
||||
}
|
||||
|
||||
private static TailType getTail(boolean last) {
|
||||
return last ? new CharTailType('>') : TailType.COMMA;
|
||||
return last ? new CharTailType('>') : CommaTailType.INSTANCE;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+3
-2
@@ -2,6 +2,7 @@
|
||||
|
||||
package com.intellij.codeInsight.completion.simple;
|
||||
|
||||
import com.intellij.codeInsight.lookup.CommaTailType;
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.editorActions.TabOutScopesTracker;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
@@ -19,7 +20,7 @@ public abstract class ParenthesesTailType extends TailType {
|
||||
|
||||
@Override
|
||||
public int processTail(final Editor editor, int tailOffset) {
|
||||
CommonCodeStyleSettings styleSettings = getLocalCodeStyleSettings(editor, tailOffset);
|
||||
CommonCodeStyleSettings styleSettings = CommaTailType.getLocalCodeStyleSettings(editor, tailOffset);
|
||||
if (isSpaceBeforeParentheses(styleSettings, editor, tailOffset)) {
|
||||
tailOffset = insertChar(editor, tailOffset, ' ');
|
||||
}
|
||||
@@ -42,4 +43,4 @@ public abstract class ParenthesesTailType extends TailType {
|
||||
return tailOffset;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.completion.simple;
|
||||
|
||||
import com.intellij.codeInsight.lookup.CommaTailType;
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
@@ -53,7 +54,7 @@ public abstract class RParenthTailType extends TailType {
|
||||
|
||||
@Override
|
||||
public int processTail(final Editor editor, int tailOffset) {
|
||||
return addRParenth(editor, tailOffset, isSpaceWithinParentheses(getLocalCodeStyleSettings(editor, tailOffset), editor, tailOffset));
|
||||
return addRParenth(editor, tailOffset, isSpaceWithinParentheses(CommaTailType.getLocalCodeStyleSettings(editor, tailOffset), editor, tailOffset));
|
||||
}
|
||||
|
||||
public static int addRParenth(Editor editor, int offset, boolean spaceWithinParens) {
|
||||
|
||||
+1
-1
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.generation.surroundWith;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightUtil;
|
||||
import com.intellij.lang.surroundWith.SurroundDescriptor;
|
||||
import com.intellij.lang.surroundWith.Surrounder;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.codeInsight.CodeInsightUtil;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.lookup;
|
||||
|
||||
import com.intellij.codeInsight.AutoPopupController;
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.*;
|
||||
import com.intellij.codeInsight.completion.*;
|
||||
import com.intellij.codeInsight.daemon.impl.JavaColorProvider;
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.HighlightControlFlowUtil;
|
||||
@@ -198,11 +197,11 @@ public class VariableLookupItem extends LookupItem<PsiVariable> implements Typed
|
||||
final char completionChar = context.getCompletionChar();
|
||||
if (completionChar == '=') {
|
||||
context.setAddCompletionChar(false);
|
||||
TailType.EQ.processTail(context.getEditor(), context.getTailOffset());
|
||||
EqTailType.INSTANCE.processTail(context.getEditor(), context.getTailOffset());
|
||||
}
|
||||
else if (completionChar == ',' && getAttribute(LookupItem.TAIL_TYPE_ATTR) != TailType.UNKNOWN) {
|
||||
context.setAddCompletionChar(false);
|
||||
TailType.COMMA.processTail(context.getEditor(), context.getTailOffset());
|
||||
CommaTailType.INSTANCE.processTail(context.getEditor(), context.getTailOffset());
|
||||
AutoPopupController.getInstance(context.getProject()).autoPopupParameterInfo(context.getEditor(), null);
|
||||
}
|
||||
else if (completionChar == ':' && getAttribute(LookupItem.TAIL_TYPE_ATTR) != TailType.UNKNOWN && isTernaryCondition(ref)) {
|
||||
|
||||
+1
-4
@@ -16,10 +16,7 @@
|
||||
package com.intellij.codeInsight.lookup.impl;
|
||||
|
||||
import com.intellij.codeInsight.completion.JavaCompletionUtil;
|
||||
import com.intellij.codeInsight.lookup.DefaultLookupItemRenderer;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementPresentation;
|
||||
import com.intellij.codeInsight.lookup.LookupItem;
|
||||
import com.intellij.codeInsight.lookup.*;
|
||||
import com.intellij.psi.PsiDocCommentOwner;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
|
||||
+1
-15
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.psi.search.scope.packageSet;
|
||||
|
||||
|
||||
+1
-70
@@ -1,21 +1,7 @@
|
||||
// Copyright 2000-2017 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.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.editor.CaretModel;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -23,8 +9,6 @@ import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -80,27 +64,6 @@ public abstract class TailType {
|
||||
|
||||
public static final TailType SEMICOLON = new CharTailType(';');
|
||||
|
||||
public static final TailType COMMA = new TailType(){
|
||||
@Override
|
||||
public int processTail(final Editor editor, int tailOffset) {
|
||||
CommonCodeStyleSettings styleSettings = getLocalCodeStyleSettings(editor, tailOffset);
|
||||
if (styleSettings.SPACE_BEFORE_COMMA) tailOffset = insertChar(editor, tailOffset, ' ');
|
||||
tailOffset = insertChar(editor, tailOffset, ',');
|
||||
if (styleSettings.SPACE_AFTER_COMMA) tailOffset = insertChar(editor, tailOffset, ' ');
|
||||
return tailOffset;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "COMMA";
|
||||
}
|
||||
};
|
||||
|
||||
protected static CommonCodeStyleSettings getLocalCodeStyleSettings(Editor editor, int tailOffset) {
|
||||
final PsiFile psiFile = getFile(editor);
|
||||
Language language = PsiUtilCore.getLanguageAtOffset(psiFile, tailOffset);
|
||||
return CodeStyle.getLanguageSettings(psiFile, language);
|
||||
}
|
||||
|
||||
protected static FileType getFileType(Editor editor) {
|
||||
PsiFile psiFile = getFile(editor);
|
||||
return psiFile.getFileType();
|
||||
@@ -166,38 +129,6 @@ public abstract class TailType {
|
||||
}
|
||||
};
|
||||
|
||||
public static final TailType EQ = new TailTypeEQ();
|
||||
|
||||
public static class TailTypeEQ extends TailType {
|
||||
|
||||
protected boolean isSpaceAroundAssignmentOperators(Editor editor, int tailOffset) {
|
||||
return getLocalCodeStyleSettings(editor, tailOffset).SPACE_AROUND_ASSIGNMENT_OPERATORS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int processTail(final Editor editor, int tailOffset) {
|
||||
Document document = editor.getDocument();
|
||||
int textLength = document.getTextLength();
|
||||
CharSequence chars = document.getCharsSequence();
|
||||
if (tailOffset < textLength - 1 && chars.charAt(tailOffset) == ' ' && chars.charAt(tailOffset + 1) == '='){
|
||||
return moveCaret(editor, tailOffset, 2);
|
||||
}
|
||||
if (tailOffset < textLength && chars.charAt(tailOffset) == '='){
|
||||
return moveCaret(editor, tailOffset, 1);
|
||||
}
|
||||
if (isSpaceAroundAssignmentOperators(editor, tailOffset)) {
|
||||
document.insertString(tailOffset, " =");
|
||||
tailOffset = moveCaret(editor, tailOffset, 2);
|
||||
tailOffset = insertChar(editor, tailOffset, ' ');
|
||||
}
|
||||
else{
|
||||
document.insertString(tailOffset, "=");
|
||||
tailOffset = moveCaret(editor, tailOffset, 1);
|
||||
}
|
||||
return tailOffset;
|
||||
}
|
||||
}
|
||||
|
||||
public static final TailType LPARENTH = new CharTailType('(');
|
||||
|
||||
public abstract int processTail(final Editor editor, int tailOffset);
|
||||
+10
-19
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
@@ -20,8 +6,6 @@ import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.util.PsiUtilBase;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -46,10 +30,17 @@ public class CompletionInitializationContext {
|
||||
private final int myInvocationCount;
|
||||
private final OffsetMap myOffsetMap;
|
||||
private String myDummyIdentifier = DUMMY_IDENTIFIER;
|
||||
private final Language myPositionLanguage;
|
||||
|
||||
public CompletionInitializationContext(final Editor editor, final @NotNull Caret caret, final PsiFile file, final CompletionType completionType, int invocationCount) {
|
||||
public CompletionInitializationContext(final Editor editor,
|
||||
final @NotNull Caret caret,
|
||||
@NotNull Language language,
|
||||
final PsiFile file,
|
||||
final CompletionType completionType,
|
||||
int invocationCount) {
|
||||
myEditor = editor;
|
||||
myCaret = caret;
|
||||
myPositionLanguage = language;
|
||||
myFile = file;
|
||||
myCompletionType = completionType;
|
||||
myInvocationCount = invocationCount;
|
||||
@@ -83,7 +74,7 @@ public class CompletionInitializationContext {
|
||||
|
||||
@NotNull
|
||||
public Language getPositionLanguage() {
|
||||
return ObjectUtils.assertNotNull(PsiUtilBase.getLanguageInEditor(getEditor(), getProject()));
|
||||
return myPositionLanguage;
|
||||
}
|
||||
|
||||
public String getDummyIdentifier() {
|
||||
+1
-23
@@ -1,31 +1,13 @@
|
||||
/*
|
||||
* Copyright 2000-2019 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.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
import com.intellij.codeInsight.lookup.Lookup;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -136,10 +118,6 @@ public class InsertionContext {
|
||||
return myAddCompletionChar;
|
||||
}
|
||||
|
||||
public CommonCodeStyleSettings getCodeStyleSettings() {
|
||||
Language lang = PsiUtilCore.getLanguageAtOffset(getFile(), getTailOffset());
|
||||
return CodeStyle.getLanguageSettings(getFile(), lang);
|
||||
}
|
||||
|
||||
public static boolean shouldAddCompletionChar(char completionChar) {
|
||||
return completionChar != Lookup.AUTO_INSERT_SELECT_CHAR &&
|
||||
+38
@@ -1,8 +1,11 @@
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
@@ -48,4 +51,39 @@ public abstract class PrefixMatcher {
|
||||
public int matchingDegree(String string) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters _names for strings that match given matcher and sorts them.
|
||||
* "Start matching" items go first, then others.
|
||||
* Within both groups names are sorted lexicographically in a case-insensitive way.
|
||||
*/
|
||||
public LinkedHashSet<String> sortMatching(Collection<String> _names) {
|
||||
ProgressManager.checkCanceled();
|
||||
if (getPrefix().isEmpty()) {
|
||||
return new LinkedHashSet<>(_names);
|
||||
}
|
||||
|
||||
List<String> sorted = new ArrayList<>();
|
||||
for (String name : _names) {
|
||||
if (prefixMatches(name)) {
|
||||
sorted.add(name);
|
||||
}
|
||||
}
|
||||
|
||||
ProgressManager.checkCanceled();
|
||||
Collections.sort(sorted, String.CASE_INSENSITIVE_ORDER);
|
||||
ProgressManager.checkCanceled();
|
||||
|
||||
LinkedHashSet<String> result = new LinkedHashSet<>();
|
||||
for (String name : sorted) {
|
||||
if (isStartMatch(name)) {
|
||||
result.add(name);
|
||||
}
|
||||
}
|
||||
|
||||
ProgressManager.checkCanceled();
|
||||
|
||||
result.addAll(sorted);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.intention.impl;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
|
||||
public abstract class QuickEditActionKeys {
|
||||
public static final Key<Boolean> EDIT_ACTION_AVAILABLE = Key.create("EDIT_ACTION_AVAILABLE");
|
||||
}
|
||||
+2
-15
@@ -1,22 +1,9 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.codeInsight.lookup;
|
||||
|
||||
import com.intellij.codeInsight.completion.PrefixMatcher;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiElement;
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.lookup;
|
||||
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.psi.impl.source.PostprocessReformattingAspect;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -34,7 +34,7 @@ public abstract class TailTypeDecorator<T extends LookupElement> extends LookupE
|
||||
|
||||
getDelegate().handleInsert(context);
|
||||
if (tailType != null && tailType.isApplicable(context)) {
|
||||
PostprocessReformattingAspect.getInstance(context.getProject()).doPostponedFormatting();
|
||||
PsiDocumentManager.getInstance(context.getProject()).doPostponedOperationsAndUnblockDocument(context.getDocument());
|
||||
int tailOffset = context.getTailOffset();
|
||||
if (tailOffset < 0) {
|
||||
throw new AssertionError("tailOffset < 0: delegate=" + getDelegate() + "; this=" + this + "; tail=" + tailType);
|
||||
@@ -0,0 +1,62 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.codeInsight;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
public abstract class AutoPopupController implements Disposable {
|
||||
/**
|
||||
* Settings this user data key to the editor with a completion provider
|
||||
* makes the autopopup scheduling ignore the state of the corresponding setting.
|
||||
* <p/>
|
||||
* This doesn't affect other conditions when autopopup is not possible (e.g. power save mode).
|
||||
*/
|
||||
public static final Key<Boolean> ALWAYS_AUTO_POPUP = Key.create("Always Show Completion Auto-Popup");
|
||||
/**
|
||||
* If editor has Boolean.TRUE by this key completion popup would be shown without advertising text at the bottom.
|
||||
*/
|
||||
public static final Key<Boolean> NO_ADS = Key.create("Show Completion Auto-Popup without Ads");
|
||||
|
||||
/**
|
||||
* If editor has Boolean.TRUE by this key completion popup would be shown every time when editor gets focus.
|
||||
* For example this key can be used for TextFieldWithAutoCompletion.
|
||||
* (TextFieldWithAutoCompletion looks like standard JTextField and completion shortcut is not obvious to be active)
|
||||
*/
|
||||
public static final Key<Boolean> AUTO_POPUP_ON_FOCUS_GAINED = Key.create("Show Completion Auto-Popup On Focus Gained");
|
||||
|
||||
|
||||
public static AutoPopupController getInstance(@NotNull Project project) {
|
||||
return project.getService(AutoPopupController.class);
|
||||
}
|
||||
|
||||
|
||||
public abstract void autoPopupMemberLookup(Editor editor, @Nullable Condition<? super PsiFile> condition);
|
||||
|
||||
public abstract void autoPopupMemberLookup(Editor editor, CompletionType completionType, @Nullable Condition<? super PsiFile> condition);
|
||||
|
||||
public abstract void scheduleAutoPopup(@NotNull Editor editor,
|
||||
@NotNull CompletionType completionType,
|
||||
@Nullable Condition<? super PsiFile> condition);
|
||||
|
||||
public abstract void scheduleAutoPopup(Editor editor);
|
||||
|
||||
public abstract void cancelAllRequests();
|
||||
|
||||
public abstract void autoPopupParameterInfo(@NotNull Editor editor, @Nullable PsiElement highlightedMethod);
|
||||
|
||||
@TestOnly
|
||||
public abstract void waitForDelayedActions(long timeout, @NotNull TimeUnit unit) throws TimeoutException;
|
||||
}
|
||||
+1
-1
@@ -293,4 +293,4 @@ private class ProjectInspectionProfileManagerState : BaseState() {
|
||||
|
||||
@get:OptionTag("USE_PROJECT_PROFILE")
|
||||
var useProjectProfile by property(true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ public class PsiUtilCore {
|
||||
return narrowLanguage(element.getLanguage(), element.getContainingFile().getLanguage());
|
||||
}
|
||||
|
||||
static Language narrowLanguage(final Language language, @NotNull Language candidate) {
|
||||
public static Language narrowLanguage(final Language language, @NotNull Language candidate) {
|
||||
if (candidate.isKindOf(language)) return candidate;
|
||||
return language;
|
||||
}
|
||||
|
||||
@@ -63,4 +63,10 @@ public class CompletionUtilCoreImpl {
|
||||
|
||||
return psi;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T extends PsiElement> T getOriginalOrSelf(@NotNull T psi) {
|
||||
final T element = getOriginalElement(psi);
|
||||
return element == null ? psi : element;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.editor;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EditorCoreUtil {
|
||||
public static void indentLine(Project project, @NotNull Editor editor, int lineNumber, int indent, boolean shouldUseSmartTabs) {
|
||||
int caretOffset = editor.getCaretModel().getOffset();
|
||||
int newCaretOffset = indentLine(project, editor, lineNumber, indent, caretOffset, shouldUseSmartTabs);
|
||||
editor.getCaretModel().moveToOffset(newCaretOffset);
|
||||
}
|
||||
|
||||
public static int indentLine(Project project, @NotNull Editor editor, int lineNumber, int indent, int caretOffset, boolean shouldUseSmartTabs) {
|
||||
EditorSettings editorSettings = editor.getSettings();
|
||||
int tabSize = editorSettings.getTabSize(project);
|
||||
Document document = editor.getDocument();
|
||||
CharSequence text = document.getImmutableCharSequence();
|
||||
int spacesEnd = 0;
|
||||
int lineStart = 0;
|
||||
int lineEnd = 0;
|
||||
int tabsEnd = 0;
|
||||
if (lineNumber < document.getLineCount()) {
|
||||
lineStart = document.getLineStartOffset(lineNumber);
|
||||
lineEnd = document.getLineEndOffset(lineNumber);
|
||||
spacesEnd = lineStart;
|
||||
boolean inTabs = true;
|
||||
for (; spacesEnd <= lineEnd; spacesEnd++) {
|
||||
if (spacesEnd == lineEnd) {
|
||||
break;
|
||||
}
|
||||
char c = text.charAt(spacesEnd);
|
||||
if (c != '\t') {
|
||||
if (inTabs) {
|
||||
inTabs = false;
|
||||
tabsEnd = spacesEnd;
|
||||
}
|
||||
if (c != ' ') break;
|
||||
}
|
||||
}
|
||||
if (inTabs) {
|
||||
tabsEnd = lineEnd;
|
||||
}
|
||||
}
|
||||
int newCaretOffset = caretOffset;
|
||||
if (newCaretOffset >= lineStart && newCaretOffset < lineEnd && spacesEnd == lineEnd) {
|
||||
spacesEnd = newCaretOffset;
|
||||
tabsEnd = Math.min(spacesEnd, tabsEnd);
|
||||
}
|
||||
int oldLength = getSpaceWidthInColumns(text, lineStart, spacesEnd, tabSize);
|
||||
tabsEnd = getSpaceWidthInColumns(text, lineStart, tabsEnd, tabSize);
|
||||
|
||||
int newLength = oldLength + indent;
|
||||
if (newLength < 0) {
|
||||
newLength = 0;
|
||||
}
|
||||
tabsEnd += indent;
|
||||
if (tabsEnd < 0) tabsEnd = 0;
|
||||
if (!shouldUseSmartTabs) tabsEnd = newLength;
|
||||
StringBuilder buf = new StringBuilder(newLength);
|
||||
for (int i = 0; i < newLength;) {
|
||||
if (tabSize > 0 && editorSettings.isUseTabCharacter(project) && i + tabSize <= tabsEnd) {
|
||||
buf.append('\t');
|
||||
i += tabSize;
|
||||
}
|
||||
else {
|
||||
buf.append(' ');
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
int newSpacesEnd = lineStart + buf.length();
|
||||
if (newCaretOffset >= spacesEnd) {
|
||||
newCaretOffset += buf.length() - (spacesEnd - lineStart);
|
||||
}
|
||||
else if (newCaretOffset >= lineStart && newCaretOffset > newSpacesEnd) {
|
||||
newCaretOffset = newSpacesEnd;
|
||||
}
|
||||
|
||||
if (buf.length() > 0) {
|
||||
if (spacesEnd > lineStart) {
|
||||
document.replaceString(lineStart, spacesEnd, buf.toString());
|
||||
}
|
||||
else {
|
||||
document.insertString(lineStart, buf.toString());
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (spacesEnd > lineStart) {
|
||||
document.deleteString(lineStart, spacesEnd);
|
||||
}
|
||||
}
|
||||
|
||||
return newCaretOffset;
|
||||
}
|
||||
|
||||
private static int getSpaceWidthInColumns(CharSequence seq, int startOffset, int endOffset, int tabSize) {
|
||||
int result = 0;
|
||||
for (int i = startOffset; i < endOffset; i++) {
|
||||
if (seq.charAt(i) == '\t') {
|
||||
result = (result / tabSize + 1) * tabSize;
|
||||
}
|
||||
else {
|
||||
result++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.completion.util;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
|
||||
public class CompletionStyleUtil {
|
||||
public static CommonCodeStyleSettings getCodeStyleSettings(InsertionContext context) {
|
||||
Language lang = PsiUtilCore.getLanguageAtOffset(context.getFile(), context.getTailOffset());
|
||||
return CodeStyle.getLanguageSettings(context.getFile(), lang);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.lookup;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class CommaTailType extends TailType {
|
||||
public static final TailType INSTANCE = new CommaTailType();
|
||||
|
||||
@Override
|
||||
public int processTail(final Editor editor, int tailOffset) {
|
||||
CommonCodeStyleSettings styleSettings = getLocalCodeStyleSettings(editor, tailOffset);
|
||||
if (styleSettings.SPACE_BEFORE_COMMA) tailOffset = insertChar(editor, tailOffset, ' ');
|
||||
tailOffset = insertChar(editor, tailOffset, ',');
|
||||
if (styleSettings.SPACE_AFTER_COMMA) tailOffset = insertChar(editor, tailOffset, ' ');
|
||||
return tailOffset;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "COMMA";
|
||||
}
|
||||
|
||||
public static CommonCodeStyleSettings getLocalCodeStyleSettings(Editor editor, int tailOffset) {
|
||||
final PsiFile psiFile = getFile(editor);
|
||||
Language language = PsiUtilCore.getLanguageAtOffset(psiFile, tailOffset);
|
||||
return CodeStyle.getLanguageSettings(psiFile, language);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static PsiFile getFile(Editor editor) {
|
||||
Project project = editor.getProject();
|
||||
assert project != null;
|
||||
PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
|
||||
assert psiFile != null;
|
||||
return psiFile;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.lookup;
|
||||
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
|
||||
public class EqTailType extends TailType {
|
||||
public static final TailType INSTANCE = new EqTailType();
|
||||
|
||||
protected boolean isSpaceAroundAssignmentOperators(Editor editor, int tailOffset) {
|
||||
return CommaTailType.getLocalCodeStyleSettings(editor, tailOffset).SPACE_AROUND_ASSIGNMENT_OPERATORS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int processTail(final Editor editor, int tailOffset) {
|
||||
Document document = editor.getDocument();
|
||||
int textLength = document.getTextLength();
|
||||
CharSequence chars = document.getCharsSequence();
|
||||
if (tailOffset < textLength - 1 && chars.charAt(tailOffset) == ' ' && chars.charAt(tailOffset + 1) == '=') {
|
||||
return moveCaret(editor, tailOffset, 2);
|
||||
}
|
||||
if (tailOffset < textLength && chars.charAt(tailOffset) == '=') {
|
||||
return moveCaret(editor, tailOffset, 1);
|
||||
}
|
||||
if (isSpaceAroundAssignmentOperators(editor, tailOffset)) {
|
||||
document.insertString(tailOffset, " =");
|
||||
tailOffset = moveCaret(editor, tailOffset, 2);
|
||||
tailOffset = insertChar(editor, tailOffset, ' ');
|
||||
}
|
||||
else {
|
||||
document.insertString(tailOffset, "=");
|
||||
tailOffset = moveCaret(editor, tailOffset, 1);
|
||||
}
|
||||
return tailOffset;
|
||||
}
|
||||
}
|
||||
@@ -44,16 +44,17 @@ public class PsiUtilBase extends PsiUtilCore implements PsiEditorUtil {
|
||||
return host != null && isUnderPsiRoot(root, host);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
public static Language getLanguageInEditor(@NotNull final Editor editor, @NotNull final Project project) {
|
||||
return getLanguageInEditor(editor.getCaretModel().getCurrentCaret(), project);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
public static Language getLanguageInEditor(@NotNull Caret caret, @NotNull final Project project) {
|
||||
Editor editor = caret.getEditor();
|
||||
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
|
||||
if (file == null) return null;
|
||||
|
||||
assert file != null;
|
||||
|
||||
int caretOffset = caret.getOffset();
|
||||
int mostProbablyCorrectLanguageOffset = caretOffset == caret.getSelectionEnd() ? caret.getSelectionStart() : caretOffset;
|
||||
@@ -89,7 +90,6 @@ public class PsiUtilBase extends PsiUtilCore implements PsiEditorUtil {
|
||||
PsiUtilCore.ensureValid(file);
|
||||
|
||||
final Language language = getLanguageInEditor(caret, project);
|
||||
if (language == null) return file;
|
||||
|
||||
if (language == file.getLanguage()) return file;
|
||||
|
||||
|
||||
+17
-37
@@ -1,5 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.codeInsight;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionPhase;
|
||||
@@ -10,7 +9,6 @@ import com.intellij.codeInsight.editorActions.CompletionAutoPopupHandler;
|
||||
import com.intellij.codeInsight.hint.ShowParameterInfoHandler;
|
||||
import com.intellij.ide.IdeEventQueue;
|
||||
import com.intellij.ide.PowerSaveMode;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
@@ -22,7 +20,6 @@ import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.IndexNotReadyException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -38,35 +35,11 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
|
||||
public class AutoPopupController implements Disposable {
|
||||
/**
|
||||
* Settings this user data key to the editor with a completion provider
|
||||
* makes the autopopup scheduling ignore the state of the corresponding setting.
|
||||
* <p/>
|
||||
* This doesn't affect other conditions when autopopup is not possible (e.g. power save mode).
|
||||
*/
|
||||
public static final Key<Boolean> ALWAYS_AUTO_POPUP = Key.create("Always Show Completion Auto-Popup");
|
||||
/**
|
||||
* If editor has Boolean.TRUE by this key completion popup would be shown without advertising text at the bottom.
|
||||
*/
|
||||
public static final Key<Boolean> NO_ADS = Key.create("Show Completion Auto-Popup without Ads");
|
||||
|
||||
/**
|
||||
* If editor has Boolean.TRUE by this key completion popup would be shown every time when editor gets focus.
|
||||
* For example this key can be used for TextFieldWithAutoCompletion.
|
||||
* (TextFieldWithAutoCompletion looks like standard JTextField and completion shortcut is not obvious to be active)
|
||||
*/
|
||||
public static final Key<Boolean> AUTO_POPUP_ON_FOCUS_GAINED = Key.create("Show Completion Auto-Popup On Focus Gained");
|
||||
|
||||
|
||||
public class AutoPopupControllerImpl extends AutoPopupController {
|
||||
private final Project myProject;
|
||||
private final Alarm myAlarm = new Alarm(this);
|
||||
|
||||
public static AutoPopupController getInstance(@NotNull Project project) {
|
||||
return project.getService(AutoPopupController.class);
|
||||
}
|
||||
|
||||
public AutoPopupController(Project project) {
|
||||
public AutoPopupControllerImpl(Project project) {
|
||||
myProject = project;
|
||||
setupListeners();
|
||||
}
|
||||
@@ -87,14 +60,17 @@ public class AutoPopupController implements Disposable {
|
||||
IdeEventQueue.getInstance().addActivityListener(this::cancelAllRequests, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autoPopupMemberLookup(final Editor editor, @Nullable final Condition<? super PsiFile> condition){
|
||||
autoPopupMemberLookup(editor, CompletionType.BASIC, condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autoPopupMemberLookup(final Editor editor, CompletionType completionType, @Nullable final Condition<? super PsiFile> condition){
|
||||
scheduleAutoPopup(editor, completionType, condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scheduleAutoPopup(@NotNull Editor editor, @NotNull CompletionType completionType, @Nullable final Condition<? super PsiFile> condition) {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode() && !TestModeFlags.is(CompletionAutoPopupHandler.ourTestingAutopopup)) {
|
||||
return;
|
||||
@@ -120,6 +96,7 @@ public class AutoPopupController implements Disposable {
|
||||
CompletionPhase.CommittingDocuments.scheduleAsyncCompletion(editor, completionType, condition, myProject, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scheduleAutoPopup(final Editor editor) {
|
||||
scheduleAutoPopup(editor, CompletionType.BASIC, null);
|
||||
}
|
||||
@@ -135,10 +112,12 @@ public class AutoPopupController implements Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelAllRequests() {
|
||||
myAlarm.cancelAllRequests();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autoPopupParameterInfo(@NotNull final Editor editor, @Nullable final PsiElement highlightedMethod){
|
||||
if (DumbService.isDumb(myProject)) return;
|
||||
if (PowerSaveMode.isEnabled()) return;
|
||||
@@ -178,14 +157,7 @@ public class AutoPopupController implements Disposable {
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated can be emulated with {@link AppUIExecutor}
|
||||
*/
|
||||
@Deprecated
|
||||
public static void runTransactionWithEverythingCommitted(@NotNull final Project project, @NotNull final Runnable runnable) {
|
||||
AppUIExecutor.onUiThread().later().withDocumentsCommitted(project).inTransaction(project).execute(runnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@TestOnly
|
||||
public void waitForDelayedActions(long timeout, @NotNull TimeUnit unit) throws TimeoutException {
|
||||
long deadline = System.currentTimeMillis() + unit.toMillis(timeout);
|
||||
@@ -196,4 +168,12 @@ public class AutoPopupController implements Disposable {
|
||||
}
|
||||
throw new TimeoutException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated can be emulated with {@link AppUIExecutor}
|
||||
*/
|
||||
@Deprecated
|
||||
public static void runTransactionWithEverythingCommitted(@NotNull final Project project, @NotNull final Runnable runnable) {
|
||||
AppUIExecutor.onUiThread().later().withDocumentsCommitted(project).inTransaction(project).execute(runnable);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -4,6 +4,7 @@ package com.intellij.codeInsight.completion;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.util.PsiUtilBase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -16,7 +17,7 @@ class CompletionInitializationContextImpl extends CompletionInitializationContex
|
||||
@NotNull Caret caret,
|
||||
PsiFile file,
|
||||
CompletionType completionType, int invocationCount) {
|
||||
super(editor, caret, file, completionType, invocationCount);
|
||||
super(editor, caret, PsiUtilBase.getLanguageInEditor(editor, file.getProject()), file, completionType, invocationCount);
|
||||
myHostOffsets = new OffsetsInFile(file, getOffsetMap()).toTopLevelFile();
|
||||
}
|
||||
|
||||
|
||||
@@ -200,41 +200,6 @@ public class CompletionUtil {
|
||||
return element == null ? psi : element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters _names for strings that match given matcher and sorts them.
|
||||
* "Start matching" items go first, then others.
|
||||
* Within both groups names are sorted lexicographically in a case-insensitive way.
|
||||
*/
|
||||
public static LinkedHashSet<String> sortMatching(final PrefixMatcher matcher, Collection<String> _names) {
|
||||
ProgressManager.checkCanceled();
|
||||
if (matcher.getPrefix().isEmpty()) {
|
||||
return new LinkedHashSet<>(_names);
|
||||
}
|
||||
|
||||
List<String> sorted = new ArrayList<>();
|
||||
for (String name : _names) {
|
||||
if (matcher.prefixMatches(name)) {
|
||||
sorted.add(name);
|
||||
}
|
||||
}
|
||||
|
||||
ProgressManager.checkCanceled();
|
||||
Collections.sort(sorted, String.CASE_INSENSITIVE_ORDER);
|
||||
ProgressManager.checkCanceled();
|
||||
|
||||
LinkedHashSet<String> result = new LinkedHashSet<>();
|
||||
for (String name : sorted) {
|
||||
if (matcher.isStartMatch(name)) {
|
||||
result.add(name);
|
||||
}
|
||||
}
|
||||
|
||||
ProgressManager.checkCanceled();
|
||||
|
||||
result.addAll(sorted);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Iterable<String> iterateLookupStrings(@NotNull final LookupElement element) {
|
||||
return new Iterable<String>() {
|
||||
@NotNull
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@
|
||||
package com.intellij.codeInsight.editorActions;
|
||||
|
||||
import com.intellij.codeInsight.AutoPopupController;
|
||||
import com.intellij.codeInsight.AutoPopupControllerImpl;
|
||||
import com.intellij.codeInsight.completion.impl.CompletionServiceImpl;
|
||||
import com.intellij.codeInsight.lookup.LookupManager;
|
||||
import com.intellij.codeInsight.lookup.impl.LookupImpl;
|
||||
@@ -53,6 +54,6 @@ public class CompletionAutoPopupHandler extends TypedHandlerDelegate {
|
||||
*/
|
||||
@Deprecated
|
||||
public static void runLaterWithCommitted(@NotNull final Project project, final Document document, @NotNull final Runnable runnable) {
|
||||
AutoPopupController.runTransactionWithEverythingCommitted(project, runnable);
|
||||
AutoPopupControllerImpl.runTransactionWithEverythingCommitted(project, runnable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,9 +52,8 @@ import java.util.List;
|
||||
* @author Gregory Shrago
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class QuickEditAction implements IntentionAction, LowPriorityAction {
|
||||
public class QuickEditAction extends QuickEditActionKeys implements IntentionAction, LowPriorityAction {
|
||||
public static final Key<QuickEditHandler> QUICK_EDIT_HANDLER = Key.create("QUICK_EDIT_HANDLER");
|
||||
public static final Key<Boolean> EDIT_ACTION_AVAILABLE = Key.create("EDIT_ACTION_AVAILABLE");
|
||||
private String myLastLanguageName;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.codeInsight.lookup;
|
||||
|
||||
import com.intellij.codeInsight.CharTailType;
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.*;
|
||||
import com.intellij.codeInsight.completion.InsertHandler;
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.codeInsight.lookup.impl.ElementLookupRenderer;
|
||||
@@ -193,9 +192,9 @@ public class LookupItem<T> extends MutableLookupElement<T> implements Comparable
|
||||
public static TailType getDefaultTailType(final char completionChar) {
|
||||
switch(completionChar){
|
||||
case '.': return new CharTailType('.', false);
|
||||
case ',': return TailType.COMMA;
|
||||
case ',': return CommaTailType.INSTANCE;
|
||||
case ';': return TailType.SEMICOLON;
|
||||
case '=': return TailType.EQ;
|
||||
case '=': return EqTailType.INSTANCE;
|
||||
case ' ': return TailType.SPACE;
|
||||
case ':': return TailType.CASE_COLON; //?
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packageDependencies.ChangeListsScopesProvider;
|
||||
import com.intellij.psi.search.*;
|
||||
import com.intellij.psi.search.GlobalSearchScopesCore;
|
||||
import com.intellij.psi.search.scope.ProjectFilesScope;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScope;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
|
||||
|
||||
+5
@@ -105,6 +105,11 @@ public final class PushedFilePropertiesUpdaterImpl extends PushedFilePropertiesU
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runConcurrentlyIfPossible(List<Runnable> tasks) {
|
||||
invokeConcurrentlyIfPossible(tasks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeProperties() {
|
||||
for (FilePropertyPusher<?> pusher : FilePropertyPusher.EP_NAME.getExtensionList()) {
|
||||
|
||||
+2
-94
@@ -110,102 +110,10 @@ public class EditorActionUtil {
|
||||
// This method avoid moving caret directly, so it's suitable for invocation in bulk mode.
|
||||
// It does calculate (and returns) target caret position.
|
||||
public static int indentLine(Project project, @NotNull Editor editor, int lineNumber, int indent, int caretOffset) {
|
||||
EditorSettings editorSettings = editor.getSettings();
|
||||
int tabSize = editorSettings.getTabSize(project);
|
||||
Document document = editor.getDocument();
|
||||
CharSequence text = document.getImmutableCharSequence();
|
||||
int spacesEnd = 0;
|
||||
int lineStart = 0;
|
||||
int lineEnd = 0;
|
||||
int tabsEnd = 0;
|
||||
if (lineNumber < document.getLineCount()) {
|
||||
lineStart = document.getLineStartOffset(lineNumber);
|
||||
lineEnd = document.getLineEndOffset(lineNumber);
|
||||
spacesEnd = lineStart;
|
||||
boolean inTabs = true;
|
||||
for (; spacesEnd <= lineEnd; spacesEnd++) {
|
||||
if (spacesEnd == lineEnd) {
|
||||
break;
|
||||
}
|
||||
char c = text.charAt(spacesEnd);
|
||||
if (c != '\t') {
|
||||
if (inTabs) {
|
||||
inTabs = false;
|
||||
tabsEnd = spacesEnd;
|
||||
}
|
||||
if (c != ' ') break;
|
||||
}
|
||||
}
|
||||
if (inTabs) {
|
||||
tabsEnd = lineEnd;
|
||||
}
|
||||
}
|
||||
int newCaretOffset = caretOffset;
|
||||
if (newCaretOffset >= lineStart && newCaretOffset < lineEnd && spacesEnd == lineEnd) {
|
||||
spacesEnd = newCaretOffset;
|
||||
tabsEnd = Math.min(spacesEnd, tabsEnd);
|
||||
}
|
||||
int oldLength = getSpaceWidthInColumns(text, lineStart, spacesEnd, tabSize);
|
||||
tabsEnd = getSpaceWidthInColumns(text, lineStart, tabsEnd, tabSize);
|
||||
|
||||
int newLength = oldLength + indent;
|
||||
if (newLength < 0) {
|
||||
newLength = 0;
|
||||
}
|
||||
tabsEnd += indent;
|
||||
if (tabsEnd < 0) tabsEnd = 0;
|
||||
if (!shouldUseSmartTabs(project, editor)) tabsEnd = newLength;
|
||||
StringBuilder buf = new StringBuilder(newLength);
|
||||
for (int i = 0; i < newLength;) {
|
||||
if (tabSize > 0 && editorSettings.isUseTabCharacter(project) && i + tabSize <= tabsEnd) {
|
||||
buf.append('\t');
|
||||
i += tabSize;
|
||||
}
|
||||
else {
|
||||
buf.append(' ');
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
int newSpacesEnd = lineStart + buf.length();
|
||||
if (newCaretOffset >= spacesEnd) {
|
||||
newCaretOffset += buf.length() - (spacesEnd - lineStart);
|
||||
}
|
||||
else if (newCaretOffset >= lineStart && newCaretOffset > newSpacesEnd) {
|
||||
newCaretOffset = newSpacesEnd;
|
||||
}
|
||||
|
||||
if (buf.length() > 0) {
|
||||
if (spacesEnd > lineStart) {
|
||||
document.replaceString(lineStart, spacesEnd, buf.toString());
|
||||
}
|
||||
else {
|
||||
document.insertString(lineStart, buf.toString());
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (spacesEnd > lineStart) {
|
||||
document.deleteString(lineStart, spacesEnd);
|
||||
}
|
||||
}
|
||||
|
||||
return newCaretOffset;
|
||||
return EditorCoreUtil.indentLine(project, editor, lineNumber, indent, caretOffset, shouldUseSmartTabs(project, editor));
|
||||
}
|
||||
|
||||
private static int getSpaceWidthInColumns(CharSequence seq, int startOffset, int endOffset, int tabSize) {
|
||||
int result = 0;
|
||||
for (int i = startOffset; i < endOffset; i++) {
|
||||
if (seq.charAt(i) == '\t') {
|
||||
result = (result / tabSize + 1) * tabSize;
|
||||
}
|
||||
else {
|
||||
result++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static boolean shouldUseSmartTabs(Project project, @NotNull Editor editor) {
|
||||
public static boolean shouldUseSmartTabs(Project project, @NotNull Editor editor) {
|
||||
if (!(editor instanceof EditorEx)) return false;
|
||||
return CodeStyle.getIndentOptions(project, editor.getDocument()).SMART_TABS;
|
||||
}
|
||||
|
||||
@@ -280,7 +280,8 @@
|
||||
serviceImplementation="com.intellij.framework.detection.impl.exclude.DetectionExcludesConfigurationImpl"/>
|
||||
<projectService serviceImplementation="com.intellij.framework.detection.impl.exclude.old.OldFacetDetectionExcludesConfiguration"/>
|
||||
|
||||
<projectService serviceImplementation="com.intellij.codeInsight.AutoPopupController"/>
|
||||
<projectService serviceInterface="com.intellij.codeInsight.AutoPopupController"
|
||||
serviceImplementation="com.intellij.codeInsight.AutoPopupControllerImpl"/>
|
||||
|
||||
<projectService serviceInterface="com.intellij.codeStyle.CodeStyleFacade"
|
||||
serviceImplementation="com.intellij.psi.impl.source.codeStyle.CodeStyleFacadeImpl"/>
|
||||
@@ -340,7 +341,7 @@
|
||||
serviceImplementation="com.intellij.openapi.roots.impl.ProjectFileIndexImpl"/>
|
||||
<testSourcesFilter implementation="com.intellij.openapi.roots.ProjectRootTestSourcesFilter"/>
|
||||
<moduleService serviceInterface="com.intellij.openapi.roots.ModuleFileIndex"
|
||||
serviceImplementation="com.intellij.openapi.roots.impl.ModuleFileIndexImpl"/>
|
||||
serviceImplementation="com.intellij.openapi.roots.impl.ModuleFileIndexImpl"/>
|
||||
<projectService serviceImplementation="com.intellij.psi.impl.source.resolve.ResolveCache"/>
|
||||
<projectService serviceInterface="com.intellij.openapi.roots.ProjectRootModificationTracker"
|
||||
serviceImplementation="com.intellij.openapi.roots.ProjectRootModificationTrackerImpl"/>
|
||||
@@ -383,7 +384,7 @@
|
||||
<useScopeEnlarger implementation="com.intellij.ide.scratch.ScratchFileServiceImpl$UseScopeExtension"/>
|
||||
<usageTypeProvider implementation="com.intellij.ide.scratch.ScratchFileServiceImpl$UsageTypeExtension" order="last"/>
|
||||
|
||||
<scratch.rootType implementation="com.intellij.ide.scratch.ScratchRootType" />
|
||||
<scratch.rootType implementation="com.intellij.ide.scratch.ScratchRootType"/>
|
||||
<scratch.rootType implementation="com.intellij.execution.console.HistoryRootType"/>
|
||||
<scratch.rootType implementation="com.intellij.execution.console.IdeConsoleRootType"/>
|
||||
|
||||
@@ -657,7 +658,7 @@
|
||||
<!-- execution -->
|
||||
<executor implementation="com.intellij.execution.executors.DefaultRunExecutor" order="first" id="run"/>
|
||||
<executionTargetProvider implementation="com.intellij.execution.DefaultExecutionTargetProvider"/>
|
||||
<projectService serviceImplementation="com.intellij.execution.RunConfigurationProducerService" />
|
||||
<projectService serviceImplementation="com.intellij.execution.RunConfigurationProducerService"/>
|
||||
<configurationType implementation="com.intellij.execution.compound.CompoundRunConfigurationType"/>
|
||||
|
||||
<findUsagesHandlerFactory implementation="com.intellij.find.findUsages.DefaultFindUsagesHandlerFactory" id="default" order="last"/>
|
||||
@@ -697,8 +698,8 @@
|
||||
id="EnterBetweenBracesHandler"/>
|
||||
<enterHandlerDelegate implementation="com.intellij.codeInsight.editorActions.enter.EnterAfterJavadocTagHandler"/>
|
||||
|
||||
<backspaceHandlerDelegate implementation="com.intellij.codeInsight.editorActions.SimpleIndentingBackspaceHandler" />
|
||||
<backspaceHandlerDelegate implementation="com.intellij.codeInsight.editorActions.SmartIndentingBackspaceHandler" />
|
||||
<backspaceHandlerDelegate implementation="com.intellij.codeInsight.editorActions.SimpleIndentingBackspaceHandler"/>
|
||||
<backspaceHandlerDelegate implementation="com.intellij.codeInsight.editorActions.SmartIndentingBackspaceHandler"/>
|
||||
|
||||
<codeInsight.linkHandler prefix="#inspection/" handlerClass="com.intellij.codeInsight.hint.InspectionDescriptionLinkHandler"/>
|
||||
<codeInsight.linkHandler prefix="#navigation/" handlerClass="com.intellij.codeInsight.hint.NavigationLinkHandler"/>
|
||||
@@ -850,10 +851,10 @@
|
||||
factoryClass="com.intellij.ide.projectView.impl.FavoritesViewToolWindowFactory"/>
|
||||
<toolWindow id="Run Dashboard" anchor="bottom" icon="AllIcons.Toolwindows.ToolWindowRun" canCloseContents="true"
|
||||
factoryClass="com.intellij.execution.dashboard.RunDashboardToolWindowFactory"
|
||||
conditionClass="com.intellij.execution.dashboard.RunDashboardToolWindowFactory" />
|
||||
conditionClass="com.intellij.execution.dashboard.RunDashboardToolWindowFactory"/>
|
||||
<toolWindow id="Services" anchor="bottom" icon="AllIcons.Toolwindows.ToolWindowServices" canCloseContents="true"
|
||||
factoryClass="com.intellij.execution.services.ServiceViewToolWindowFactory"
|
||||
conditionClass="com.intellij.execution.services.ServiceViewToolWindowFactory" />
|
||||
conditionClass="com.intellij.execution.services.ServiceViewToolWindowFactory"/>
|
||||
|
||||
<psi.fileReferenceHelper implementation="com.intellij.psi.impl.source.resolve.reference.impl.providers.PsiFileReferenceHelper"/>
|
||||
<psi.fileReferenceHelper implementation="com.intellij.psi.impl.source.resolve.reference.impl.providers.JarFileReferenceHelper"/>
|
||||
@@ -897,9 +898,9 @@
|
||||
groupKey="inspection.general.tools.group.name" enabledByDefault="false"
|
||||
level="WARNING" implementationClass="com.intellij.codeInspection.longLine.LongLineInspection"/>
|
||||
<localInspection shortName="ProjectFingerprint" displayName="Project Fingerprint" bundle="messages.InspectionsBundle"
|
||||
groupKey="inspection.general.tools.group.name" enabledByDefault="false"
|
||||
level="WARNING" implementationClass="com.intellij.codeInspection.projectFingerprint.ProjectFingerprintInspection"
|
||||
presentation="com.intellij.codeInspection.projectFingerprint.ProjectFingerprintInspectionPresentation"/>
|
||||
groupKey="inspection.general.tools.group.name" enabledByDefault="false"
|
||||
level="WARNING" implementationClass="com.intellij.codeInspection.projectFingerprint.ProjectFingerprintInspection"
|
||||
presentation="com.intellij.codeInspection.projectFingerprint.ProjectFingerprintInspectionPresentation"/>
|
||||
<globalInspection shortName="RedundantSuppression" bundle="messages.InspectionsBundle" key="inspection.redundant.suppression.name"
|
||||
groupKey="inspection.general.tools.group.name" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.intellij.codeInspection.RedundantSuppressInspection"/>
|
||||
@@ -962,7 +963,7 @@
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.editor.EditorSettingsStatisticsCollector"/>
|
||||
<statistics.projectUsagesCollector implementation="com.intellij.internal.statistic.editor.EditorSettingsStatisticsCollector$ProjectUsages"/>
|
||||
<statistics.projectUsagesCollector implementation="com.intellij.internal.statistic.tools.InspectionsUsagesCollector"/>
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.service.fus.collectors.KeymapUsageCollector" />
|
||||
<statistics.applicationUsagesCollector implementation="com.intellij.internal.statistic.service.fus.collectors.KeymapUsageCollector"/>
|
||||
<statistics.projectUsagesCollector implementation="com.intellij.execution.dashboard.RunDashboardUsagesCollector"/>
|
||||
|
||||
<statistics.counterUsagesCollector groupId="searchEverywhere" version="1"/>
|
||||
@@ -1094,7 +1095,7 @@
|
||||
<search.optionContributor implementation="com.intellij.codeInspection.ex.InspectionSearchableOptionContributor"/>
|
||||
|
||||
<fileIndentOptionsProvider implementation="com.intellij.psi.codeStyle.DetectableIndentOptionsProvider" order="last"/>
|
||||
<statusBarWidgetProvider implementation="com.intellij.psi.codeStyle.statusbar.CodeStyleStatusBarWidgetProvider" />
|
||||
<statusBarWidgetProvider implementation="com.intellij.psi.codeStyle.statusbar.CodeStyleStatusBarWidgetProvider"/>
|
||||
<lang.formatter.restriction implementation="com.intellij.formatting.ExcludedFileFormattingRestriction"/>
|
||||
|
||||
<codeInsight.lineMarkerProvider language="" implementationClass="com.intellij.execution.lineMarker.RunLineMarkerProvider"/>
|
||||
@@ -1106,33 +1107,33 @@
|
||||
<daemon.tooltipActionProvider order="last" id="defaultProvider" implementation="com.intellij.codeInsight.daemon.impl.DaemonTooltipActionProvider" />
|
||||
|
||||
<schemeExporter
|
||||
name="IntelliJ IDEA code style XML"
|
||||
schemeClass="com.intellij.psi.codeStyle.CodeStyleScheme"
|
||||
implementationClass="com.intellij.application.options.schemes.SerializableSchemeExporter"/>
|
||||
name="IntelliJ IDEA code style XML"
|
||||
schemeClass="com.intellij.psi.codeStyle.CodeStyleScheme"
|
||||
implementationClass="com.intellij.application.options.schemes.SerializableSchemeExporter"/>
|
||||
<schemeExporter
|
||||
name="IntelliJ IDEA color scheme (.icls)"
|
||||
schemeClass="com.intellij.openapi.editor.colors.EditorColorsScheme"
|
||||
implementationClass="com.intellij.application.options.colors.ColorSchemeExporter"/>
|
||||
name="IntelliJ IDEA color scheme (.icls)"
|
||||
schemeClass="com.intellij.openapi.editor.colors.EditorColorsScheme"
|
||||
implementationClass="com.intellij.application.options.colors.ColorSchemeExporter"/>
|
||||
<schemeExporter
|
||||
name="Color scheme plugin .jar"
|
||||
schemeClass="com.intellij.openapi.editor.colors.EditorColorsScheme"
|
||||
implementationClass="com.intellij.application.options.colors.pluginExport.ColorSchemePluginExporter"/>
|
||||
<schemeImporter
|
||||
name="IntelliJ IDEA code style XML"
|
||||
schemeClass="com.intellij.psi.codeStyle.CodeStyleScheme"
|
||||
implementationClass="com.intellij.psi.impl.source.codeStyle.CodeStyleSchemeXmlImporter"/>
|
||||
name="IntelliJ IDEA code style XML"
|
||||
schemeClass="com.intellij.psi.codeStyle.CodeStyleScheme"
|
||||
implementationClass="com.intellij.psi.impl.source.codeStyle.CodeStyleSchemeXmlImporter"/>
|
||||
<schemeImporter
|
||||
name="IntelliJ IDEA color scheme (.icls) or settings (.jar)"
|
||||
schemeClass="com.intellij.openapi.editor.colors.EditorColorsScheme"
|
||||
implementationClass="com.intellij.application.options.colors.ColorSchemeImporter"/>
|
||||
name="IntelliJ IDEA color scheme (.icls) or settings (.jar)"
|
||||
schemeClass="com.intellij.openapi.editor.colors.EditorColorsScheme"
|
||||
implementationClass="com.intellij.application.options.colors.ColorSchemeImporter"/>
|
||||
<schemeExporter
|
||||
name="IntelliJ IDEA inspection profile XML"
|
||||
schemeClass="com.intellij.codeInspection.ex.InspectionProfileModifiableModel"
|
||||
implementationClass="com.intellij.application.options.schemes.SerializableSchemeExporter"/>
|
||||
name="IntelliJ IDEA inspection profile XML"
|
||||
schemeClass="com.intellij.codeInspection.ex.InspectionProfileModifiableModel"
|
||||
implementationClass="com.intellij.application.options.schemes.SerializableSchemeExporter"/>
|
||||
<schemeImporter
|
||||
name="IntelliJ IDEA inspection profile XML"
|
||||
schemeClass="com.intellij.codeInspection.ex.InspectionProfileModifiableModel"
|
||||
implementationClass="com.intellij.profile.codeInspection.ui.InspectionProfileImporter"/>
|
||||
name="IntelliJ IDEA inspection profile XML"
|
||||
schemeClass="com.intellij.codeInspection.ex.InspectionProfileModifiableModel"
|
||||
implementationClass="com.intellij.profile.codeInspection.ui.InspectionProfileImporter"/>
|
||||
|
||||
<nonProjectFileWritingAccessExtension implementation="com.intellij.ide.actions.EditCustomPropertiesAction$AccessExtension"/>
|
||||
<nonProjectFileWritingAccessExtension implementation="com.intellij.ide.actions.EditCustomVmOptionsAction$AccessExtension"/>
|
||||
@@ -1143,7 +1144,7 @@
|
||||
|
||||
<applicationService serviceImplementation="com.intellij.ide.projectView.impl.ProjectViewFileNestingService"/>
|
||||
<treeStructureProvider implementation="com.intellij.ide.projectView.impl.NestingTreeStructureProvider" order="last"/>
|
||||
<applicationService serviceImplementation="com.intellij.ide.projectView.impl.FileNestingBuilder" />
|
||||
<applicationService serviceImplementation="com.intellij.ide.projectView.impl.FileNestingBuilder"/>
|
||||
<refactoring.safeDeleteProcessor implementation="com.intellij.refactoring.safeDelete.RelatedFilesSafeDeleteProcessorDelegate"/>
|
||||
<automaticRenamerFactory implementation="com.intellij.refactoring.rename.RelatedFilesRenamerFactory"/>
|
||||
<refactoring.moveHandler implementation="com.intellij.refactoring.move.moveFilesOrDirectories.MoveRelatedFilesHandler"
|
||||
@@ -1154,10 +1155,10 @@
|
||||
serviceImplementation="com.intellij.ide.actions.searcheverywhere.SearchEverywhereManagerImpl"/>
|
||||
<projectService serviceImplementation="com.intellij.ide.actions.runAnything.RunAnythingManager"/>
|
||||
|
||||
<searchEverywhereContributor implementation="com.intellij.ide.actions.searcheverywhere.ClassSearchEverywhereContributor$Factory" />
|
||||
<searchEverywhereContributor implementation="com.intellij.ide.actions.searcheverywhere.FileSearchEverywhereContributor$Factory" />
|
||||
<searchEverywhereContributor implementation="com.intellij.ide.actions.searcheverywhere.SymbolSearchEverywhereContributor$Factory" />
|
||||
<searchEverywhereContributor implementation="com.intellij.ide.actions.searcheverywhere.ActionSearchEverywhereContributor$Factory" />
|
||||
<searchEverywhereContributor implementation="com.intellij.ide.actions.searcheverywhere.ClassSearchEverywhereContributor$Factory"/>
|
||||
<searchEverywhereContributor implementation="com.intellij.ide.actions.searcheverywhere.FileSearchEverywhereContributor$Factory"/>
|
||||
<searchEverywhereContributor implementation="com.intellij.ide.actions.searcheverywhere.SymbolSearchEverywhereContributor$Factory"/>
|
||||
<searchEverywhereContributor implementation="com.intellij.ide.actions.searcheverywhere.ActionSearchEverywhereContributor$Factory"/>
|
||||
|
||||
<searchEverywhereResultsEqualityProvider implementation="com.intellij.ide.actions.searcheverywhere.TrivialElementsEqualityProvider"/>
|
||||
<searchEverywhereResultsEqualityProvider implementation="com.intellij.ide.actions.searcheverywhere.PsiElementsEqualityProvider"/>
|
||||
|
||||
+2
-4
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.psi.search.scope.packageSet;
|
||||
|
||||
@@ -15,4 +13,4 @@ public class PatternRegexpConvertorTest extends TestCase {
|
||||
assertEquals("a\\/(.*\\/)?[^\\/]*", FilePatternPackageSet.convertToRegexp("a//*", '/'));
|
||||
assertEquals("[^\\.]*", FilePatternPackageSet.convertToRegexp("*", '.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -6,7 +6,11 @@ import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class PushedFilePropertiesUpdater {
|
||||
public abstract void runConcurrentlyIfPossible(List<Runnable> tasks);
|
||||
|
||||
@NotNull
|
||||
public static PushedFilePropertiesUpdater getInstance(@NotNull Project project) {
|
||||
return project.getComponent(PushedFilePropertiesUpdater.class);
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.lang.completion;
|
||||
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.lookup.EqTailType;
|
||||
import com.intellij.codeInsight.completion.*;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
@@ -133,7 +133,7 @@ class GroovyConfigSlurperCompletionProvider extends CompletionProvider<Completio
|
||||
|
||||
LookupElement lookupElement = LookupElementBuilder.create(variant);
|
||||
if (entry.getValue()) {
|
||||
lookupElement = TailTypeDecorator.withTail(lookupElement, TailType.EQ);
|
||||
lookupElement = TailTypeDecorator.withTail(lookupElement, EqTailType.INSTANCE);
|
||||
}
|
||||
|
||||
result.addElement(lookupElement);
|
||||
|
||||
+4
-3
@@ -3,9 +3,10 @@
|
||||
package org.jetbrains.plugins.groovy.lang.completion;
|
||||
|
||||
import com.intellij.codeInsight.AutoPopupController;
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.lookup.EqTailType;
|
||||
import com.intellij.codeInsight.completion.InsertHandler;
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.codeInsight.completion.util.CompletionStyleUtil;
|
||||
import com.intellij.codeInsight.completion.util.MethodParenthesesHandler;
|
||||
import com.intellij.codeInsight.completion.util.ParenthesesInsertHandler;
|
||||
import com.intellij.codeInsight.lookup.Lookup;
|
||||
@@ -119,7 +120,7 @@ public class GroovyInsertHandler implements InsertHandler<LookupElement> {
|
||||
}
|
||||
|
||||
|
||||
CommonCodeStyleSettings settings = context.getCodeStyleSettings();
|
||||
CommonCodeStyleSettings settings = CompletionStyleUtil.getCodeStyleSettings(context);
|
||||
ParenthesesInsertHandler.getInstance(MethodParenthesesHandler.hasParams(item, context.getElements(), true, method),
|
||||
settings.SPACE_BEFORE_METHOD_CALL_PARENTHESES,
|
||||
settings.SPACE_WITHIN_METHOD_CALL_PARENTHESES,
|
||||
@@ -157,7 +158,7 @@ public class GroovyInsertHandler implements InsertHandler<LookupElement> {
|
||||
|
||||
if (context.getCompletionChar() == '=') {
|
||||
context.setAddCompletionChar(false);
|
||||
TailType.EQ.processTail(context.getEditor(), context.getTailOffset());
|
||||
EqTailType.INSTANCE.processTail(context.getEditor(), context.getTailOffset());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -2,6 +2,7 @@
|
||||
package org.jetbrains.plugins.groovy.mvc.util;
|
||||
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.lookup.EqTailType;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.codeInsight.lookup.TailTypeDecorator;
|
||||
@@ -175,7 +176,7 @@ public class MvcTargetDialogCompletionUtils {
|
||||
);
|
||||
}
|
||||
|
||||
public static class MyTailTypeEQ extends TailType.TailTypeEQ {
|
||||
public static class MyTailTypeEQ extends EqTailType {
|
||||
public static final MyTailTypeEQ INSTANCE = new MyTailTypeEQ();
|
||||
|
||||
@Override
|
||||
@@ -187,5 +188,4 @@ public class MvcTargetDialogCompletionUtils {
|
||||
return "MvcTargetDialogCompletionUtils.TailTypeEQ";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.jetbrains.plugins.groovy.util;
|
||||
|
||||
import com.intellij.codeInsight.lookup.CommaTailType;
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -25,7 +26,7 @@ public class FieldInitializerTailTypes extends TailType {
|
||||
|
||||
@Override
|
||||
public int processTail(Editor editor, int tailOffset) {
|
||||
CommonCodeStyleSettings styleSettings = getLocalCodeStyleSettings(editor, tailOffset);
|
||||
CommonCodeStyleSettings styleSettings = CommaTailType.getLocalCodeStyleSettings(editor, tailOffset);
|
||||
Document document = editor.getDocument();
|
||||
CharSequence chars = document.getCharsSequence();
|
||||
int textLength = chars.length();
|
||||
|
||||
@@ -73,6 +73,7 @@ public class PyNames {
|
||||
public static final String VERBOSE_REG_EXP_LANGUAGE_ID = "PythonVerboseRegExp";
|
||||
@NonNls public static final String PYTHON_MODULE_ID = "PYTHON_MODULE";
|
||||
public static final String TESTCASE_SETUP_NAME = "setUp";
|
||||
public static final String PY_DOCSTRING_ID = "PyDocstring";
|
||||
|
||||
private PyNames() {
|
||||
}
|
||||
|
||||
@@ -16,9 +16,12 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.lang" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.impl" />
|
||||
<orderEntry type="library" name="kotlin-stdlib-jdk8" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.lang.impl" />
|
||||
<orderEntry type="module" module-name="intellij.python.community" />
|
||||
<orderEntry type="library" name="jsoup" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.testFramework" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.indexing.impl" />
|
||||
<orderEntry type="library" name="StreamEx" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.analysis.impl" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -49,6 +49,10 @@ public class PythonRuntimeService {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String mapToRemote(@NotNull String localRoot, @NotNull Sdk sdk) {
|
||||
return localRoot;
|
||||
}
|
||||
|
||||
public static PythonRuntimeService getInstance() {
|
||||
return ServiceManager.getService(PythonRuntimeService.class);
|
||||
}
|
||||
|
||||
+4
-3
@@ -5,7 +5,7 @@ import com.intellij.codeInsight.completion.InsertHandler;
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.actions.EditorActionUtil;
|
||||
import com.intellij.openapi.editor.EditorCoreUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -96,9 +96,10 @@ public class PyUnindentingInsertHandler implements InsertHandler<PythonLookupEle
|
||||
assert outer_indent >= 0;
|
||||
int current_indent = nonspace_offset - line_start_offset;
|
||||
int indent = outer_indent - current_indent;
|
||||
EditorActionUtil.indentLine(project, editor, document.getLineNumber(offset), editor.getSettings().isUseTabCharacter(project)
|
||||
EditorCoreUtil.indentLine(project, editor, document.getLineNumber(offset), editor.getSettings().isUseTabCharacter(project)
|
||||
? indent * editor.getSettings().getTabSize(project)
|
||||
: indent);
|
||||
: indent, false);
|
||||
//TODO!!!: shouldUseSmartTabs! is it applicable?
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
+3
-3
@@ -20,7 +20,7 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
|
||||
import com.jetbrains.python.codeInsight.dataflow.scope.ScopeUtil;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import com.jetbrains.python.psi.search.PyProjectScopeBuilder;
|
||||
import com.jetbrains.python.psi.search.PySearchUtilBase;
|
||||
import com.jetbrains.python.psi.stubs.PyClassNameIndex;
|
||||
import com.jetbrains.python.psi.stubs.PyFunctionNameIndex;
|
||||
import com.jetbrains.python.psi.stubs.PyVariableNameIndex;
|
||||
@@ -112,11 +112,11 @@ public class PyClassNameCompletionContributor extends PyExtendedCompletionContri
|
||||
@NotNull Class<T> elementClass,
|
||||
@NotNull Function<LookupElement, LookupElement> elementHandler) {
|
||||
final Project project = targetFile.getProject();
|
||||
final GlobalSearchScope scope = PyProjectScopeBuilder.excludeSdkTestsScope(targetFile);
|
||||
final GlobalSearchScope scope = PySearchUtilBase.excludeSdkTestsScope(targetFile);
|
||||
final Map<String, LookupElement> uniqueResults = new HashMap<>();
|
||||
|
||||
final Collection<String> keys = StubIndex.getInstance().getAllKeys(key, project);
|
||||
for (final String elementName : CompletionUtil.sortMatching(resultSet.getPrefixMatcher(), keys)) {
|
||||
for (final String elementName : resultSet.getPrefixMatcher().sortMatching(keys)) {
|
||||
for (T element : StubIndex.getElements(key, elementName, project, scope, elementClass)) {
|
||||
if (condition.value(element)) {
|
||||
final String name = element.getName();
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ import com.intellij.patterns.PsiElementPattern;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.filters.ElementFilter;
|
||||
import com.intellij.psi.filters.position.FilterPattern;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedFileViewProvider;
|
||||
import com.intellij.psi.impl.FreeThreadedFileViewProvider;
|
||||
import com.intellij.psi.templateLanguages.OuterLanguageElement;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
@@ -152,7 +152,7 @@ public class PyKeywordCompletionContributor extends CompletionContributor {
|
||||
PsiDocumentManager docMgr = PsiDocumentManager.getInstance(p.getProject());
|
||||
final PsiFile file = p.getContainingFile().getOriginalFile();
|
||||
Document doc = docMgr.getDocument(file);
|
||||
String indentCharacters = file.getViewProvider() instanceof InjectedFileViewProvider? " \t>": " \t";
|
||||
String indentCharacters = file.getViewProvider() instanceof FreeThreadedFileViewProvider ? " \t>" : " \t";
|
||||
|
||||
if (doc != null) {
|
||||
CharSequence chs = doc.getCharsSequence();
|
||||
|
||||
+3
-2
@@ -2,7 +2,7 @@
|
||||
package com.jetbrains.python.documentation.docstrings;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.codeInsight.completion.CompletionUtil;
|
||||
import com.intellij.codeInsight.completion.CompletionUtilCoreImpl;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
@@ -122,7 +122,8 @@ public class DocStringTypeReference extends PsiPolyVariantReferenceBase<PsiEleme
|
||||
for (PyImportElement element : elements) {
|
||||
final PyReferenceExpression referenceExpression = element.getImportReferenceExpression();
|
||||
if (referenceExpression == null) continue;
|
||||
final PyType type = TypeEvalContext.userInitiated(file.getProject(), CompletionUtil.getOriginalOrSelf(file)).getType(referenceExpression);
|
||||
final PyType type = TypeEvalContext.userInitiated(file.getProject(), CompletionUtilCoreImpl
|
||||
.getOriginalOrSelf(file)).getType(referenceExpression);
|
||||
if (type instanceof PyClassType) {
|
||||
variants.add(((PyClassType)type).getPyClass());
|
||||
}
|
||||
|
||||
+12
-45
@@ -305,7 +305,7 @@ public class PyDocstringGenerator {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private PyStringLiteralExpression getDocStringExpression() {
|
||||
public PyStringLiteralExpression getDocStringExpression() {
|
||||
Preconditions.checkNotNull(myDocStringOwner, "For this action docstring owner must be supplied");
|
||||
return myDocStringOwner.getDocStringExpression();
|
||||
}
|
||||
@@ -315,48 +315,6 @@ public class PyDocstringGenerator {
|
||||
return myDocStringText == null ? null : DocStringUtil.parseDocString(myDocStringFormat, myDocStringText);
|
||||
}
|
||||
|
||||
public void startTemplate() {
|
||||
Preconditions.checkNotNull(myDocStringOwner, "For this action docstring owner must be supplied");
|
||||
final PyStringLiteralExpression docStringExpression = getDocStringExpression();
|
||||
assert docStringExpression != null;
|
||||
|
||||
final TemplateBuilder builder = TemplateBuilderFactory.getInstance().createTemplateBuilder(docStringExpression);
|
||||
|
||||
if (myAddedParams.size() > 1) {
|
||||
throw new IllegalArgumentException("TemplateBuilder can be created only for one parameter");
|
||||
}
|
||||
|
||||
final DocstringParam paramToEdit = getParamToEdit();
|
||||
final DocStringFormat format = myDocStringFormat;
|
||||
if (format == DocStringFormat.PLAIN) {
|
||||
return;
|
||||
}
|
||||
final StructuredDocString parsed = DocStringUtil.parseDocString(format, docStringExpression);
|
||||
final Substring substring;
|
||||
if (paramToEdit.isReturnValue()) {
|
||||
substring = parsed.getReturnTypeSubstring();
|
||||
}
|
||||
else {
|
||||
final String paramName = paramToEdit.getName();
|
||||
substring = parsed.getParamTypeSubstring(paramName);
|
||||
}
|
||||
if (substring == null) {
|
||||
return;
|
||||
}
|
||||
builder.replaceRange(substring.getTextRange(), getDefaultType(getParamToEdit()));
|
||||
Template template = PyUtil.updateDocumentUnblockedAndCommitted(myDocStringOwner, document -> {
|
||||
return ((TemplateBuilderImpl)builder).buildInlineTemplate();
|
||||
});
|
||||
final VirtualFile virtualFile = myDocStringOwner.getContainingFile().getVirtualFile();
|
||||
if (virtualFile == null) return;
|
||||
final Project project = myDocStringOwner.getProject();
|
||||
final Editor targetEditor = PsiUtilBase.findEditor(myDocStringOwner);
|
||||
if (targetEditor != null && template != null) {
|
||||
targetEditor.getCaretModel().moveToOffset(docStringExpression.getTextOffset());
|
||||
TemplateManager.getInstance(project).startTemplate(targetEditor, template);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getPreferredParameterName(@NotNull PyNamedParameter parameter) {
|
||||
if (getDocStringFormat() == DocStringFormat.GOOGLE && parameter.getAsNamed() != null) {
|
||||
@@ -367,7 +325,7 @@ public class PyDocstringGenerator {
|
||||
|
||||
|
||||
@NotNull
|
||||
private static String getDefaultType(@NotNull DocstringParam param) {
|
||||
public static String getDefaultType(@NotNull DocstringParam param) {
|
||||
if (StringUtil.isEmpty(param.getType())) {
|
||||
return PyNames.OBJECT;
|
||||
}
|
||||
@@ -499,7 +457,7 @@ public class PyDocstringGenerator {
|
||||
return myQuotes + '\n' + myDocStringIndent + myQuotes;
|
||||
}
|
||||
|
||||
private DocstringParam getParamToEdit() {
|
||||
public DocstringParam getParamToEdit() {
|
||||
if (myAddedParams.size() == 0) {
|
||||
throw new IllegalStateException("We should have at least one param to edit");
|
||||
}
|
||||
@@ -641,5 +599,14 @@ public class PyDocstringGenerator {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PyDocStringOwner getDocStringOwner() {
|
||||
return myDocStringOwner;
|
||||
}
|
||||
|
||||
public List<DocstringParam> getAddedParams() {
|
||||
return myAddedParams;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
package com.jetbrains.python.documentation.doctest;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.codeInsight.completion.CompletionUtil;
|
||||
import com.intellij.codeInsight.completion.CompletionUtilCoreImpl;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
@@ -140,7 +140,7 @@ public class PyDocReference extends PyReferenceImpl {
|
||||
@NotNull
|
||||
public Object[] getVariants() {
|
||||
final ArrayList<Object> ret = Lists.newArrayList(super.getVariants());
|
||||
final PyQualifiedExpression originalElement = CompletionUtil.getOriginalElement(myElement);
|
||||
final PyQualifiedExpression originalElement = CompletionUtilCoreImpl.getOriginalElement(myElement);
|
||||
final PyQualifiedExpression element = originalElement != null ? originalElement : myElement;
|
||||
|
||||
final ScopeOwner scopeOwner = getHostScopeOwner();
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jetbrains.python.documentation.doctest;
|
||||
|
||||
import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.PythonFileType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -32,7 +33,7 @@ public class PyDocstringFileType extends PythonFileType {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return "PyDocstring";
|
||||
return PyNames.PY_DOCSTRING_ID;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+5
-3
@@ -15,21 +15,23 @@
|
||||
*/
|
||||
package com.jetbrains.python.documentation.doctest;
|
||||
|
||||
import com.intellij.codeInsight.intention.impl.QuickEditAction;
|
||||
import com.intellij.codeInsight.intention.impl.QuickEditActionKeys;
|
||||
import com.intellij.lang.DependentLanguage;
|
||||
import com.intellij.lang.Language;
|
||||
import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.PythonLanguage;
|
||||
|
||||
/**
|
||||
* User : ktisha
|
||||
*/
|
||||
public class PyDocstringLanguageDialect extends Language implements DependentLanguage {
|
||||
|
||||
public static PyDocstringLanguageDialect getInstance() {
|
||||
return (PyDocstringLanguageDialect)PyDocstringFileType.INSTANCE.getLanguage();
|
||||
}
|
||||
|
||||
protected PyDocstringLanguageDialect() {
|
||||
super(PythonLanguage.getInstance(), "PyDocstring");
|
||||
putUserData(QuickEditAction.EDIT_ACTION_AVAILABLE, false);
|
||||
super(PythonLanguage.getInstance(), PyNames.PY_DOCSTRING_ID);
|
||||
putUserData(QuickEditActionKeys.EDIT_ACTION_AVAILABLE, false);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python.psi.impl;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionUtil;
|
||||
import com.intellij.codeInsight.completion.CompletionUtilCoreImpl;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -657,7 +657,7 @@ public class PyCallExpressionHelper {
|
||||
if (second_type instanceof PyClassType) {
|
||||
// imitate isinstance(second_arg, possible_class)
|
||||
PyClass secondClass = ((PyClassType)second_type).getPyClass();
|
||||
if (CompletionUtil.getOriginalOrSelf(firstClass) == secondClass) {
|
||||
if (CompletionUtilCoreImpl.getOriginalOrSelf(firstClass) == secondClass) {
|
||||
return getSuperClassUnionType(firstClass, context);
|
||||
}
|
||||
if (secondClass.isSubclass(firstClass, context)) {
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.jetbrains.python.psi.impl;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.codeInsight.completion.CompletionUtil;
|
||||
import com.intellij.codeInsight.completion.CompletionUtilCoreImpl;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.navigation.ItemPresentation;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
@@ -1246,7 +1246,7 @@ public class PyClassImpl extends PyBaseElementImpl<PyClassStub> implements PyCla
|
||||
final Map<String, PyTargetExpression> declarationsInMethod = new HashMap<>();
|
||||
final PyFunction instanceMethod = PsiTreeUtil.getStubOrPsiParentOfType(location, PyFunction.class);
|
||||
final PyClass containingClass = instanceMethod != null ? instanceMethod.getContainingClass() : null;
|
||||
if (instanceMethod != null && containingClass != null && CompletionUtil.getOriginalElement(containingClass) == this) {
|
||||
if (instanceMethod != null && containingClass != null && CompletionUtilCoreImpl.getOriginalElement(containingClass) == this) {
|
||||
collectInstanceAttributes(instanceMethod, declarationsInMethod);
|
||||
for (PyTargetExpression targetExpression : declarationsInMethod.values()) {
|
||||
if (!processor.execute(targetExpression, ResolveState.initial())) {
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.jetbrains.python.psi.impl;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionUtil;
|
||||
import com.intellij.codeInsight.completion.CompletionUtilCoreImpl;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
@@ -42,7 +42,7 @@ public class PyKeywordArgumentReference extends PsiReferenceBase.Poly<PyKeywordA
|
||||
@NotNull
|
||||
@Override
|
||||
public Object[] getVariants() {
|
||||
final PyKeywordArgument originalElement = CompletionUtil.getOriginalElement(myElement);
|
||||
final PyKeywordArgument originalElement = CompletionUtilCoreImpl.getOriginalElement(myElement);
|
||||
if (originalElement != null) {
|
||||
final List<LookupElement> ret = new ArrayList<>();
|
||||
final TypeEvalContext evalCtx = TypeEvalContext.codeCompletion(originalElement.getProject(), originalElement.getContainingFile());
|
||||
|
||||
+1
-2
@@ -23,7 +23,6 @@ import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.roots.impl.FilePropertyPusher;
|
||||
import com.intellij.openapi.roots.impl.PushedFilePropertiesUpdater;
|
||||
import com.intellij.openapi.roots.impl.PushedFilePropertiesUpdaterImpl;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -286,7 +285,7 @@ public class PythonLanguageLevelPusher implements FilePropertyPusher<LanguageLev
|
||||
if (project.isDisposed()) return;
|
||||
final PerformanceWatcher.Snapshot snapshot = PerformanceWatcher.takeSnapshot();
|
||||
final List<Runnable> tasks = ReadAction.compute(() -> getRootUpdateTasks(project, sdks));
|
||||
PushedFilePropertiesUpdaterImpl.invokeConcurrentlyIfPossible(tasks);
|
||||
PushedFilePropertiesUpdater.getInstance(project).runConcurrentlyIfPossible(tasks);
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
snapshot.logResponsivenessSinceCreation("Pushing Python language level to " + tasks.size() + " roots in " + sdks.size() +
|
||||
" SDKs");
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python.psi.impl.references;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionUtil;
|
||||
import com.intellij.codeInsight.completion.CompletionUtilCoreImpl;
|
||||
import com.intellij.codeInsight.completion.InsertHandler;
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
@@ -87,7 +87,7 @@ public class PyImportReference extends PyReferenceImpl {
|
||||
|
||||
PyExpression qualifier = myElement.getQualifier();
|
||||
final TypeEvalContext context = TypeEvalContext.codeCompletion(myElement.getProject(),
|
||||
CompletionUtil.getOriginalOrSelf(myElement).getContainingFile());
|
||||
CompletionUtilCoreImpl.getOriginalOrSelf(myElement).getContainingFile());
|
||||
if (qualifier != null) {
|
||||
// qualifier's type must be module, it should know how to complete
|
||||
PyType type = context.getType(qualifier);
|
||||
|
||||
+14
-14
@@ -15,7 +15,8 @@
|
||||
*/
|
||||
package com.jetbrains.python.psi.impl.references;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionUtil;
|
||||
import com.intellij.codeInsight.completion.CompletionInitializationContext;
|
||||
import com.intellij.codeInsight.completion.CompletionUtilCoreImpl;
|
||||
import com.intellij.codeInsight.lookup.AutoCompletionPolicy;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
@@ -27,13 +28,11 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.ProjectScope;
|
||||
import com.intellij.psi.stubs.StubUpdatingIndex;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.QualifiedName;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import com.intellij.util.indexing.FileBasedIndex;
|
||||
import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.codeInsight.controlflow.ControlFlowCache;
|
||||
import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
|
||||
@@ -48,7 +47,7 @@ import com.jetbrains.python.psi.resolve.ImplicitResolveResult;
|
||||
import com.jetbrains.python.psi.resolve.PyResolveContext;
|
||||
import com.jetbrains.python.psi.resolve.QualifiedNameFinder;
|
||||
import com.jetbrains.python.psi.resolve.RatedResolveResult;
|
||||
import com.jetbrains.python.psi.search.PyProjectScopeBuilder;
|
||||
import com.jetbrains.python.psi.search.PySearchUtilBase;
|
||||
import com.jetbrains.python.psi.stubs.PyClassAttributesIndex;
|
||||
import com.jetbrains.python.psi.stubs.PyClassNameIndexInsensitive;
|
||||
import com.jetbrains.python.psi.stubs.PyFunctionNameIndex;
|
||||
@@ -129,7 +128,7 @@ public class PyQualifiedReference extends PyReferenceImpl {
|
||||
}
|
||||
if (match.size() > 1) {
|
||||
final PyClass ourClass = PyiUtil.getOriginalElementOrLeaveAsIs(qualifierType.getPyClass(), PyClass.class);
|
||||
final PsiElement theirClass = CompletionUtil.getOriginalOrSelf(match.get(match.size() - 1));
|
||||
final PsiElement theirClass = CompletionUtilCoreImpl.getOriginalOrSelf(match.get(match.size() - 1));
|
||||
if (ourClass != theirClass) return true;
|
||||
}
|
||||
return false;
|
||||
@@ -137,7 +136,7 @@ public class PyQualifiedReference extends PyReferenceImpl {
|
||||
|
||||
private void addImplicitResolveResults(String referencedName, ResolveResultList ret) {
|
||||
final Project project = myElement.getProject();
|
||||
final GlobalSearchScope scope = PyProjectScopeBuilder.excludeSdkTestsScope(project);
|
||||
final GlobalSearchScope scope = PySearchUtilBase.excludeSdkTestsScope(project);
|
||||
final Collection functions = PyFunctionNameIndex.find(referencedName, project, scope);
|
||||
final PsiFile containingFile = myElement.getContainingFile();
|
||||
final List<QualifiedName> imports;
|
||||
@@ -148,11 +147,12 @@ public class PyQualifiedReference extends PyReferenceImpl {
|
||||
imports = Collections.emptyList();
|
||||
}
|
||||
for (Object function : functions) {
|
||||
if (!(function instanceof PyFunction)) {
|
||||
FileBasedIndex.getInstance().scheduleRebuild(StubUpdatingIndex.INDEX_ID,
|
||||
new Throwable("found non-function object " + function + " in function list"));
|
||||
break;
|
||||
}
|
||||
//TODO: most likely the following code is obsolete
|
||||
//if (!(function instanceof PyFunction)) {
|
||||
// FileBasedIndex.getInstance().scheduleRebuild(StubUpdatingIndex.INDEX_ID,
|
||||
// new Throwable("found non-function object " + function + " in function list"));
|
||||
// break;
|
||||
//}
|
||||
PyFunction pyFunction = (PyFunction)function;
|
||||
if (pyFunction.getContainingClass() != null) {
|
||||
ret.add(new ImplicitResolveResult(pyFunction, getImplicitResultRate(pyFunction, imports)));
|
||||
@@ -258,12 +258,12 @@ public class PyQualifiedReference extends PyReferenceImpl {
|
||||
public Object[] getVariants() {
|
||||
PyExpression qualifier = myElement.getQualifier();
|
||||
if (qualifier != null) {
|
||||
qualifier = CompletionUtil.getOriginalOrSelf(qualifier);
|
||||
qualifier = CompletionUtilCoreImpl.getOriginalOrSelf(qualifier);
|
||||
}
|
||||
if (qualifier == null) {
|
||||
return EMPTY_ARRAY;
|
||||
}
|
||||
final PyQualifiedExpression element = CompletionUtil.getOriginalOrSelf(myElement);
|
||||
final PyQualifiedExpression element = CompletionUtilCoreImpl.getOriginalOrSelf(myElement);
|
||||
|
||||
PyType qualifierType = TypeEvalContext.codeCompletion(element.getProject(), element.getContainingFile()).getType(qualifier);
|
||||
ProcessingContext ctx = new ProcessingContext();
|
||||
@@ -285,7 +285,7 @@ public class PyQualifiedReference extends PyReferenceImpl {
|
||||
final Collection<PyTargetExpression> attrs = collectAssignedAttributes(qualifiedName, qualifier);
|
||||
for (PyTargetExpression expression : attrs) {
|
||||
final String name = expression.getName();
|
||||
if (name != null && name.endsWith(CompletionUtil.DUMMY_IDENTIFIER_TRIMMED)) {
|
||||
if (name != null && name.endsWith(CompletionInitializationContext.DUMMY_IDENTIFIER.trim())) {
|
||||
continue;
|
||||
}
|
||||
if (qualifierType instanceof PyClassType && name != null) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user