fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper.findServiceInContext()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper.findServiceInContext()方法的一些代码示例,展示了YamlHelper.findServiceInContext()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlHelper.findServiceInContext()方法的具体详情如下:
包路径:fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper
类名称:YamlHelper
方法名:findServiceInContext

YamlHelper.findServiceInContext介绍

[英]Finds top most service of any given PsiElement context
[中]查找任何给定元素上下文中最顶级的服务

代码示例

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

@Override
public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement psiElement) {
  if(psiElement.getContainingFile().getFileType() != YAMLFileType.YML || !Symfony2ProjectComponent.isEnabled(psiElement.getProject())) {
    return false;
  }
  return YamlHelper.findServiceInContext(psiElement) != null;
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

/**
 * @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#findServiceInContext
 */
public void testFindServiceInContext() {
  assertEquals("foo", YamlHelper.findServiceInContext(myFixture.configureByText(YAMLFileType.YML, "" +
    "services:\n" +
    "  foo:\n" +
    "    tags:\n" +
    "      - { name: fo<caret>o}\n"
  ).findElementAt(myFixture.getCaretOffset())).getKeyText());
  assertEquals("foo", YamlHelper.findServiceInContext(myFixture.configureByText(YAMLFileType.YML, "" +
    "services:\n" +
    "  foo:\n" +
    "    class: fo<caret>o"
  ).findElementAt(myFixture.getCaretOffset())).getKeyText());
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

@Override
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement psiElement) throws IncorrectOperationException {
  YAMLKeyValue serviceKeyValue = YamlHelper.findServiceInContext(psiElement);
  if(serviceKeyValue == null) {
    return;

相关文章