actions) {
final PsiFile file = InjectedLanguageManager.getInstance(node.getProject()).getTopLevelFile(node);
if (!(file instanceof PyFile)) return;
- AutoImportQuickFix importFix = PythonReferenceImporter.proposeImportFix(node, reference);
+ AutoImportQuickFix importFix = PythonImportUtils.proposeImportFix(node, reference);
if (importFix != null) {
if (!suppressHintForAutoImport(node, importFix) && PyCodeInsightSettings.getInstance().SHOW_IMPORT_POPUP) {
final AutoImportHintAction autoImportHintAction = new AutoImportHintAction(importFix);
diff --git a/python/src/com/jetbrains/python/psi/impl/PyGotoDeclarationHandler.java b/python/src/com/jetbrains/python/psi/impl/PyGotoDeclarationHandler.java
new file mode 100644
index 000000000000..b85f15212731
--- /dev/null
+++ b/python/src/com/jetbrains/python/psi/impl/PyGotoDeclarationHandler.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+package com.jetbrains.python.psi.impl;
+
+import com.intellij.codeInsight.navigation.actions.GotoDeclarationHandlerBase;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.psi.PsiElement;
+import com.jetbrains.python.psi.PyReferenceOwner;
+import com.jetbrains.python.psi.resolve.PyResolveContext;
+import com.jetbrains.python.psi.types.TypeEvalContext;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * {@link com.intellij.codeInsight.navigation.actions.GotoDeclarationAction} uses {@link PsiElement#findReferenceAt(int)}.
+ * This method knows nothing about execution context and {@link PyBaseElementImpl} injects loose {@link TypeEvalContext}.
+ * While regular methods are indexed, {@link com.jetbrains.python.codeInsight.PyCustomMember} are not.
+ * As result, "go to declaration" failed to resolve reference pointing to another files which leads to bugs like PY-18089.
+ *
+ * "Go to declaration" is always user-initiated action, so we resolve it manually using best conext
+ *
+ * @author Ilya.Kazakevich
+ */
+public final class PyGotoDeclarationHandler extends GotoDeclarationHandlerBase {
+ @Nullable
+ @Override
+ public PsiElement getGotoDeclarationTarget(@Nullable final PsiElement sourceElement, final Editor editor) {
+ if (sourceElement == null) {
+ return null;
+ }
+ PyReferenceOwner referenceOwner = null;
+ if (sourceElement instanceof PyReferenceOwner) {
+ referenceOwner = (PyReferenceOwner)sourceElement;
+ }
+ else if (sourceElement.getParent() instanceof PyReferenceOwner) {
+ referenceOwner = (PyReferenceOwner)sourceElement.getParent(); //Reference expression may be parent of IDENTIFIER
+ }
+ if (referenceOwner == null) {
+ return null;
+ }
+
+ final PyResolveContext context = PyResolveContext.noImplicits()
+ .withTypeEvalContext(TypeEvalContext.userInitiated(sourceElement.getProject(), sourceElement.getContainingFile()));
+ final PsiElement psiElement = referenceOwner.getReference(context).resolve();
+ if (psiElement == null) {
+ return null;
+ }
+ return psiElement;
+ }
+}
diff --git a/resources-en/src/inspectionDescriptions/BlockMarkerComments.html b/resources-en/src/inspectionDescriptions/BlockMarkerComments.html
index a101cf2e3a06..8fc8aaef9378 100644
--- a/resources-en/src/inspectionDescriptions/BlockMarkerComments.html
+++ b/resources-en/src/inspectionDescriptions/BlockMarkerComments.html
@@ -1,18 +1,3 @@
-
This inspection reports comments which are code block markers
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlFileImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlFileImpl.java
index 82429fe43b54..bf03ac07a2a2 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlFileImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlFileImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -31,6 +31,9 @@ import com.intellij.psi.xml.XmlElementType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.util.Collection;
+import java.util.Collections;
+
/**
* @author maxim
*/
@@ -91,4 +94,9 @@ public class HtmlFileImpl extends XmlFileImpl implements FileReferenceResolver {
return getManager().findFile(childFile);
}
}
+
+ @Override
+ public Collection