File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/main/java/fr/adrienbrault/idea/symfony2plugin/util/completion Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -42,12 +42,16 @@ public void getLookupElements(@NotNull GotoCompletionProviderLookupArguments arg
42
42
PhpIndex phpIndex = PhpIndex .getInstance (this .getProject ());
43
43
CompletionResultSet resultSet = arguments .getResultSet ();
44
44
45
- final String prefix = getElement ().getText ().replace (CompletionUtil .DUMMY_IDENTIFIER_TRIMMED , "" );
45
+ var elementText = getElement ().getText ();
46
+ var scopeOperatorPos = elementText .indexOf (SCOPE_OPERATOR );
47
+ var cursorPos = elementText .indexOf (CompletionUtil .DUMMY_IDENTIFIER_TRIMMED );
46
48
47
49
// Class constants: !php/const Foo::<caret>
48
- if (prefix .contains (SCOPE_OPERATOR )) {
49
- String classFQN = prefix .substring (0 , getElement ().getText ().indexOf (SCOPE_OPERATOR ));
50
- PhpClass phpClass = PhpElementsUtil .getClassInterface (this .getProject (), classFQN );
50
+ if (scopeOperatorPos > -1 && scopeOperatorPos < cursorPos ) {
51
+ var prefix = elementText .replace (CompletionUtil .DUMMY_IDENTIFIER_TRIMMED , "" );
52
+ var classFQN = prefix .substring (0 , scopeOperatorPos );
53
+ var phpClass = PhpElementsUtil .getClassInterface (this .getProject (), classFQN );
54
+
51
55
if (phpClass != null ) {
52
56
// reset the prefix matcher, starting after ::
53
57
resultSet = resultSet .withPrefixMatcher (prefix .substring (prefix .indexOf (SCOPE_OPERATOR ) + 2 ));
You can’t perform that action at this time.
0 commit comments