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
4242 PhpIndex phpIndex = PhpIndex .getInstance (this .getProject ());
4343 CompletionResultSet resultSet = arguments .getResultSet ();
4444
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 );
4648
4749 // 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+
5155 if (phpClass != null ) {
5256 // reset the prefix matcher, starting after ::
5357 resultSet = resultSet .withPrefixMatcher (prefix .substring (prefix .indexOf (SCOPE_OPERATOR ) + 2 ));
You can’t perform that action at this time.
0 commit comments