Java Code Examples for org.jetbrains.yaml.psi.YAMLKeyValue#getKeyText()
The following examples show how to use
org.jetbrains.yaml.psi.YAMLKeyValue#getKeyText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MenuIndex.java From idea-php-drupal-symfony2-bridge with MIT License | 6 votes |
@NotNull @Override public DataIndexer<String, Void, FileContent> getIndexer() { return inputData -> { Map<String, Void> map = new THashMap<>(); PsiFile psiFile = inputData.getPsiFile(); if(!(psiFile instanceof YAMLFile) || !psiFile.getName().endsWith(".menu.yml")) { return map; } for (YAMLKeyValue yamlKeyValue : YamlHelper.getTopLevelKeyValues((YAMLFile) psiFile)) { String keyText = yamlKeyValue.getKeyText(); if(StringUtils.isBlank(keyText)) { continue; } map.put(keyText, null); } return map; }; }
Example 2
Source File: PermissionIndex.java From idea-php-drupal-symfony2-bridge with MIT License | 6 votes |
@NotNull @Override public DataIndexer<String, Void, FileContent> getIndexer() { return inputData -> { Map<String, Void> map = new THashMap<>(); PsiFile psiFile = inputData.getPsiFile(); if(!(psiFile instanceof YAMLFile) || !psiFile.getName().endsWith(".permissions.yml")) { return map; } for (YAMLKeyValue yamlKeyValue : YamlHelper.getTopLevelKeyValues((YAMLFile) psiFile)) { String keyText = yamlKeyValue.getKeyText(); if(StringUtils.isBlank(keyText)) { continue; } map.put(keyText, null); } return map; }; }
Example 3
Source File: KubernetesYamlDocumentationProvider.java From intellij-kubernetes with Apache License 2.0 | 5 votes |
/** * Attempts to find the matching schema information on the property described by the given element. * * @param element the element to search from. * @return the matching {@link PropertyCompletionItem}, or {@code null} if one cannot be determined. */ @Nullable private PropertyCompletionItem findPropertyFromElement(@NotNull final PsiElement element) { final ModelProvider modelProvider = ModelProvider.INSTANCE; final ResourceTypeKey resourceKey = KubernetesYamlPsiUtil.findResourceKey(element); if (resourceKey != null && element instanceof YAMLKeyValue) { final YAMLKeyValue keyValue = (YAMLKeyValue) element; final Property property = KubernetesYamlPsiUtil.propertyForKey(modelProvider, resourceKey, keyValue); if (property != null) { return new PropertyCompletionItem(keyValue.getKeyText(), property); } } return null; }
Example 4
Source File: YamlLineMarkerProvider.java From idea-php-symfony2-plugin with MIT License | 4 votes |
private void visitServiceId(@NotNull PsiElement leafTarget, @NotNull YAMLKeyValue yamlKeyValue, @NotNull Collection<LineMarkerInfo> result, @NotNull LazyDecoratedParentServiceValues lazyDecoratedServices) { String id = yamlKeyValue.getKeyText(); if(StringUtils.isBlank(id)) { return; } // decorates: foobar String decorates = YamlHelper.getYamlKeyValueAsString(yamlKeyValue, "decorates"); if(decorates != null && StringUtils.isNotBlank(decorates)) { result.add(ServiceUtil.getLineMarkerForDecoratesServiceId(leafTarget, ServiceUtil.ServiceLineMarker.DECORATE, decorates)); } // parent: foobar String parent = YamlHelper.getYamlKeyValueAsString(yamlKeyValue, "parent"); if(parent != null && StringUtils.isNotBlank(parent)) { result.add(ServiceUtil.getLineMarkerForDecoratesServiceId(leafTarget, ServiceUtil.ServiceLineMarker.PARENT, parent)); } // foreign "decorates" linemarker NavigationGutterIconBuilder<PsiElement> decorateLineMarker = ServiceUtil.getLineMarkerForDecoratedServiceId( yamlKeyValue.getProject(), ServiceUtil.ServiceLineMarker.DECORATE, lazyDecoratedServices.getDecoratedServices(), id ); if(decorateLineMarker != null) { result.add(decorateLineMarker.createLineMarkerInfo(leafTarget)); } // foreign "parent" linemarker NavigationGutterIconBuilder<PsiElement> parentLineMarker = ServiceUtil.getLineMarkerForDecoratedServiceId( yamlKeyValue.getProject(), ServiceUtil.ServiceLineMarker.PARENT, lazyDecoratedServices.getDecoratedServices(), id ); if(parentLineMarker != null) { result.add(parentLineMarker.createLineMarkerInfo(leafTarget)); } }