Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kudos to this implementation
@Override | ||
public void visitElement(PsiElement element) { | ||
|
||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this try catch
and add additional checks if needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added try{ only for finally section. Without finally I had to replace each { return; } to { super.visitElement(element); return; } :) Ofc I can change it if you don't like try{ here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I saw better example here: https://github.com/Haehnchen/idea-php-symfony2-plugin/blob/master/src/fr/adrienbrault/idea/symfony2plugin/stubs/indexes/AnnotationRoutesStubIndex.java#L158 I'll change
return; | ||
} | ||
|
||
if (method.getContainingClass() == null || !availableClasses.contains(method.getContainingClass().getPresentableFQN())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am normally normalizing classes and stripping \
first. so looks also valid here because of using add("Blade")
and add("\Blade")
|
||
public class BladeCustomDirectivesVisitor extends PsiRecursiveElementVisitor { | ||
|
||
private Set<String> availableClasses = new HashSet<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a STATIC variable would be better because then there is no need to rebuild availableClasses
every time
return; | ||
} | ||
|
||
Method method = Symfony2InterfacesUtil.getMultiResolvedMethod(methodReference); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are not allowed to use resolve
in index process. the index process make it possible to resolve such methods so as you can see there is a conflict in intellij api usage here. :)
i think this works in you case because getMultiResolvedMethod
does not leave the current file document. if you extend more classes in PhpClass itself you will run it this issue.
you are just allowed to use document. so try to match against some method name or class usage. for example https://github.com/Haehnchen/idea-php-symfony2-plugin/blob/master/src/fr/adrienbrault/idea/symfony2plugin/stubs/indexes/AnnotationRoutesStubIndex.java. it collect all @Route
php annotations
|
||
String directiveName = psiElement.getText().substring(1); | ||
|
||
FileBasedIndexImpl.getInstance().getFilesWithKey( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FileBasedIndex
would be right Impl
is just the implementation
@adelf which parameter are not working? in Blade file itself or PHP files |
|
Sometthing is wrong with downloading phpstorm versions |
... that is annoying me at lot, fixed in master an merged. 👍 |
I've implemented completion for blade custom directives. But php autocompletion for parameters doesn't work. Should we do something with it, or Blade plugin is better place to implement it?