From 5803887375c86f8654fb0282027a34b333ad7144 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 24 Feb 2015 20:04:18 +0100 Subject: [PATCH] when retrieving available intention actions, use offset where the menu is going to be displayed instead of the current offset (IDEA-105329) --- .../codeInsight/daemon/impl/ShowIntentionsPass.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java index da055a4d1044..9020b07c22c9 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 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. @@ -40,6 +40,7 @@ import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.LogicalPosition; import com.intellij.openapi.editor.RangeMarker; +import com.intellij.openapi.editor.actions.EditorActionUtil; import com.intellij.openapi.editor.markup.GutterIconRenderer; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.progress.ProgressIndicator; @@ -78,7 +79,8 @@ public class ShowIntentionsPass extends TextEditorHighlightingPass { @NotNull public static List getAvailableActions(@NotNull final Editor editor, @NotNull final PsiFile file, final int passId) { - final int offset = editor.getCaretModel().getOffset(); + final Integer expectedCaretOffset = editor.getUserData(EditorActionUtil.EXPECTED_CARET_OFFSET); + final int offset = expectedCaretOffset != null ? expectedCaretOffset : editor.getCaretModel().getOffset(); final Project project = file.getProject(); final List result = new ArrayList(); -- 2.32.0