本文整理了Java中fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper.visitServiceCall()
方法的一些代码示例,展示了YamlHelper.visitServiceCall()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlHelper.visitServiceCall()
方法的具体详情如下:
包路径:fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper
类名称:YamlHelper
方法名:visitServiceCall
[英]service_name: class: FOOBAR calls: - [onFoobar, []] FOOBAR: calls: - [onFoobar, []]
[中]
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@NotNull
private Collection<PsiElement> getMethodGoto(@NotNull PsiElement psiElement) {
Collection<PsiElement> results = new ArrayList<>();
PsiElement parent = psiElement.getParent();
if(parent instanceof YAMLScalar) {
YamlHelper.visitServiceCall((YAMLScalar) parent, clazz -> {
PhpClass phpClass = ServiceUtil.getResolvedClassDefinition(psiElement.getProject(),clazz);
if(phpClass != null) {
for(Method method: PhpElementsUtil.getClassPublicMethod(phpClass)) {
if(method.getName().equals(PsiElementUtils.trimQuote(psiElement.getText()))) {
results.add(method);
}
}
}
});
}
return results;
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
protected void addCompletions(@NotNull CompletionParameters completionParameters, ProcessingContext processingContext, @NotNull CompletionResultSet completionResultSet) {
if(!Symfony2ProjectComponent.isEnabled(completionParameters.getPosition())) {
return;
}
// - [ setContainer, [ @service_container ] ]
PsiElement psiElement = completionParameters.getPosition();
PsiElement yamlScalar = psiElement.getParent();
if(yamlScalar instanceof YAMLScalar) {
YamlHelper.visitServiceCall((YAMLScalar) yamlScalar, clazz -> {
PhpClass phpClass = ServiceUtil.getResolvedClassDefinition(psiElement.getProject(), clazz);
if(phpClass != null) {
PhpElementsUtil.addClassPublicMethodCompletion(completionResultSet, phpClass);
}
});
}
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
private void visitYamlMethod(PsiElement psiElement, ProblemsHolder holder, ContainerCollectionResolver.LazyServiceCollector collector) {
if(YamlElementPatternHelper.getInsideKeyValue("calls").accepts(psiElement)) {
PsiElement parent = psiElement.getParent();
if ((parent instanceof YAMLScalar)) {
YamlHelper.visitServiceCall((YAMLScalar) parent, s ->
registerMethodProblem(psiElement, holder, YamlHelper.trimSpecialSyntaxServiceName(s), collector)
);
}
}
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#visitServiceCall
*/
public void testVisitServiceCall() {
myFixture.configureByText(YAMLFileType.YML, "services:\n" +
" foobar:\n" +
" class: Foo\\Bar\n" +
" calls:\n" +
" - [ '<caret>' ]\n"
);
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
YAMLScalar parent = (YAMLScalar) psiElement.getParent();
Collection<String> values = new ArrayList<>();
YamlHelper.visitServiceCall(parent, values::add);
assertContainsElements(values, "Foo\\Bar");
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#visitServiceCall
*/
public void testVisitServiceCallForNamedServices() {
myFixture.configureByText(YAMLFileType.YML, "services:\n" +
" Foo\\Bar:\n" +
" calls:\n" +
" - [ '<caret>' ]\n"
);
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
YAMLScalar parent = (YAMLScalar) psiElement.getParent();
Collection<String> values = new ArrayList<>();
YamlHelper.visitServiceCall(parent, values::add);
assertContainsElements(values, "Foo\\Bar");
}
内容来源于网络,如有侵权,请联系作者删除!