gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-18 14:01:31 24 4
gpt4 key购买 nike

本文整理了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;

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com