Skip to content

Commit

Permalink
Highlight func keyword when caret is on return
Browse files Browse the repository at this point in the history
  • Loading branch information
ilinum committed Nov 26, 2015
1 parent 6dcdfa4 commit 070fbb6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@

package com.goide.highlighting.exitpoint;

import com.goide.GoTypes;
import com.goide.psi.*;
import com.goide.psi.impl.GoPsiImplUtil;
import com.intellij.codeInsight.highlighting.HighlightUsagesHandlerBase;
import com.intellij.openapi.editor.Editor;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.impl.source.tree.LeafPsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.Consumer;
import com.intellij.util.containers.ContainerUtil;
Expand Down Expand Up @@ -55,8 +53,8 @@ protected void selectTargets(List<PsiElement> targets, @NotNull Consumer<List<Ps

@Override
public void computeUsages(List<PsiElement> targets) {
if (myTarget instanceof LeafPsiElement && ((LeafPsiElement)myTarget).getElementType() == GoTypes.FUNC) {
addOccurrence(myTarget);
if (myFunction instanceof GoFunctionOrMethodDeclaration) {
addOccurrence(((GoFunctionOrMethodDeclaration)myFunction).getFunc());
}
new GoRecursiveVisitor() {
@Override
Expand Down
2 changes: 1 addition & 1 deletion tests/com/goide/editor/GoExitPointsHighlightingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void testBasicExitPoints() {
" }" +
" return x\n" +
"}";
doTest(text, "return -1", "return x");
doTest(text, "func", "return -1", "return x");
}

public void testCaretOnFuncWithReturnAndPanic() {
Expand Down

0 comments on commit 070fbb6

Please sign in to comment.