7
7
import com .intellij .patterns .PsiElementPattern ;
8
8
import com .intellij .psi .PsiElement ;
9
9
import com .intellij .psi .PsiFile ;
10
+ import com .intellij .psi .tree .IElementType ;
10
11
import com .jetbrains .php .PhpIndex ;
11
12
import com .jetbrains .php .lang .psi .elements .Field ;
12
13
import com .jetbrains .php .lang .psi .elements .Method ;
21
22
import fr .adrienbrault .idea .symfony2plugin .util .yaml .YamlHelper ;
22
23
import org .jetbrains .annotations .NotNull ;
23
24
import org .jetbrains .annotations .Nullable ;
24
- import org .jetbrains .yaml .YAMLLanguage ;
25
25
import org .jetbrains .yaml .YAMLTokenTypes ;
26
26
import org .jetbrains .yaml .psi .YAMLKeyValue ;
27
27
import org .jetbrains .yaml .psi .YAMLMapping ;
@@ -43,21 +43,27 @@ public PsiElement[] getGotoDeclarationTargets(PsiElement psiElement, int i, Edit
43
43
return null ;
44
44
}
45
45
46
- // only string values like "foo", foo
47
- if (!PlatformPatterns .psiElement (YAMLTokenTypes .TEXT ).withLanguage (YAMLLanguage .INSTANCE ).accepts (psiElement )
48
- && !PlatformPatterns .psiElement (YAMLTokenTypes .SCALAR_DSTRING ).withLanguage (YAMLLanguage .INSTANCE ).accepts (psiElement )
49
- && !PlatformPatterns .psiElement (YAMLTokenTypes .SCALAR_STRING ).withLanguage (YAMLLanguage .INSTANCE ).accepts (psiElement )) {
46
+ List <PsiElement > psiElements = new ArrayList <PsiElement >();
47
+
48
+ // yaml Plugin BC: "!php/const:" is a tag
49
+ IElementType elementType = psiElement .getNode ().getElementType ();
50
+ if (elementType == YAMLTokenTypes .TAG ) {
51
+ String psiText = PsiElementUtils .getText (psiElement );
52
+ if (psiText != null && psiText .length () > 0 && psiText .startsWith ("!php/const:" )) {
53
+ psiElements .addAll (constantGoto (psiElement , psiText ));
54
+ }
55
+ }
50
56
51
- return new PsiElement []{};
57
+ // only string values like "foo", foo
58
+ if (elementType != YAMLTokenTypes .TEXT && elementType != YAMLTokenTypes .SCALAR_DSTRING && elementType != YAMLTokenTypes .SCALAR_STRING ) {
59
+ return psiElements .toArray (new PsiElement [psiElements .size ()]);
52
60
}
53
61
54
62
String psiText = PsiElementUtils .getText (psiElement );
55
63
if (null == psiText || psiText .length () == 0 ) {
56
- return new PsiElement []{} ;
64
+ return psiElements . toArray ( new PsiElement [psiElements . size ()]) ;
57
65
}
58
66
59
- List <PsiElement > psiElements = new ArrayList <PsiElement >();
60
-
61
67
if (psiText .startsWith ("@" ) && psiText .length () > 1 ) {
62
68
psiElements .addAll (Arrays .asList ((serviceGoToDeclaration (psiElement , psiText .substring (1 )))));
63
69
}
0 commit comments