org.jetbrains.yaml.YAMLLanguage Java Examples
The following examples show how to use
org.jetbrains.yaml.YAMLLanguage.
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: SiteConfigurationCompletionContributor.java From idea-php-typo3-plugin with MIT License | 5 votes |
@NotNull private PsiElementPattern.Capture<PsiElement> yamlKeyChildOfInArray() { return PlatformPatterns .psiElement(YAMLTokenTypes.SCALAR_KEY) .withSuperParent(2, YAMLMapping.class) .withSuperParent(1, YAMLKeyValue.class) .withLanguage(YAMLLanguage.INSTANCE); }
Example #2
Source File: YamlElementPatternHelper.java From idea-php-symfony2-plugin with MIT License | 5 votes |
/** * find common service parameter: %foo%, %foo%, %foo% */ public static ElementPattern<PsiElement> getServiceParameterDefinition() { return PlatformPatterns .psiElement().with(SCALAR_ELEMENT_TYPES) .withParent( PlatformPatterns.psiElement(YAMLScalar.class).with(new YAMLScalarValueStartsWithPatternCondition("%")) ) .withLanguage(YAMLLanguage.INSTANCE); }
Example #3
Source File: YamlElementPatternHelper.java From idea-php-symfony2-plugin with MIT License | 5 votes |
/** * find common services: @foo, "@foo", '@foo' */ public static ElementPattern<PsiElement> getServiceDefinition() { return PlatformPatterns .psiElement().with(SCALAR_ELEMENT_TYPES) .withParent( PlatformPatterns.psiElement(YAMLScalar.class).with(new YAMLScalarValueStartsWithPatternCondition("@")) ) .withLanguage(YAMLLanguage.INSTANCE); }
Example #4
Source File: YamlElementPatternHelper.java From idea-php-symfony2-plugin with MIT License | 5 votes |
public static ElementPattern<PsiElement> getSingleLineTextOrTag() { return PlatformPatterns.or( PlatformPatterns .psiElement(YAMLTokenTypes.TEXT) .withParent(PlatformPatterns.psiElement(YAMLScalar.class) // .withParent(PlatformPatterns // .psiElement(YAMLKeyValue.class) // ) ) .withLanguage(YAMLLanguage.INSTANCE), PlatformPatterns .psiElement(YAMLTokenTypes.TAG) .withLanguage(YAMLLanguage.INSTANCE) ); }
Example #5
Source File: YamlElementPatternHelper.java From idea-php-symfony2-plugin with MIT License | 5 votes |
public static ElementPattern<PsiElement> getSingleLineText() { return PlatformPatterns .psiElement(YAMLTokenTypes.TEXT) .withParent(PlatformPatterns.psiElement(YAMLScalar.class) .withParent(PlatformPatterns.or( PlatformPatterns.psiElement(YAMLKeyValue.class), PlatformPatterns.psiElement(YAMLSequenceItem.class) ) ) ) .withLanguage(YAMLLanguage.INSTANCE) ; }
Example #6
Source File: YamlElementPatternHelper.java From idea-php-symfony2-plugin with MIT License | 5 votes |
public static ElementPattern<PsiElement> getSingleLineScalarKey(String... keyName) { // key: | and key: "quote" is valid here // getKeyPattern return PlatformPatterns.or( PlatformPatterns .psiElement(YAMLTokenTypes.TEXT) .withParent(PlatformPatterns.psiElement(YAMLScalar.class) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withName( PlatformPatterns.string().oneOf(keyName) ) )) .withLanguage(YAMLLanguage.INSTANCE) , PlatformPatterns .psiElement(YAMLTokenTypes.SCALAR_DSTRING) .withParent(PlatformPatterns.psiElement(YAMLScalar.class) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withName( PlatformPatterns.string().oneOf(keyName) ) )) .withLanguage(YAMLLanguage.INSTANCE), PlatformPatterns .psiElement(YAMLTokenTypes.SCALAR_STRING) .withParent(PlatformPatterns.psiElement(YAMLScalar.class) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withName( PlatformPatterns.string().oneOf(keyName) ) )) .withLanguage(YAMLLanguage.INSTANCE) ); }
Example #7
Source File: YamlReferenceContributor.java From intellij-swagger with MIT License | 5 votes |
private PsiElementPattern.Capture<YAMLQuotedText> mappingSchemaNamePattern() { return psiElement(YAMLQuotedText.class) .withSuperParent(3, psiElement(YAMLKeyValue.class).withName("mapping")) .withoutText(StandardPatterns.string().contains(SwaggerConstants.REFERENCE_PREFIX)) .withoutText(FILE_NAME_PATTERN) .withoutText(URL_PATTERN) .withLanguage(YAMLLanguage.INSTANCE); }
Example #8
Source File: YamlElementPatternHelper.java From intellij-neos with GNU General Public License v3.0 | 5 votes |
public static ElementPattern<PsiElement> getWithFirstRootKey() { return PlatformPatterns.and(PlatformPatterns.or( // foo: // <caret> PlatformPatterns .psiElement().with(new ParentPathPatternCondition( YAMLScalar.class, YAMLMapping.class, YAMLKeyValue.class, YAMLMapping.class, YAMLDocument.class )) .withLanguage(YAMLLanguage.INSTANCE), // foo: // <caret> (on incomplete) PlatformPatterns .psiElement().afterLeaf( PlatformPatterns.psiElement(YAMLTokenTypes.INDENT).with( new ParentPathPatternCondition(YAMLKeyValue.class, YAMLMapping.class, YAMLDocument.class) ) ) .withLanguage(YAMLLanguage.INSTANCE), // foo: // fo<caret>: PlatformPatterns.psiElement().with(new ParentPathPatternCondition( YAMLKeyValue.class, YAMLMapping.class, YAMLKeyValue.class, YAMLMapping.class, YAMLDocument.class) ) )); }
Example #9
Source File: YamlReferenceContributor.java From intellij-swagger with MIT License | 5 votes |
private PsiElementPattern.Capture<YAMLQuotedText> localDefinitionsPattern() { return psiElement(YAMLQuotedText.class) .andOr( psiElement() .withParent(psiElement(YAMLKeyValue.class).withName(SwaggerConstants.REF_KEY)), psiElement().withSuperParent(3, psiElement(YAMLKeyValue.class).withName("mapping"))) .withText(StandardPatterns.string().contains(SwaggerConstants.REFERENCE_PREFIX)) .withoutText(FILE_NAME_PATTERN) .withoutText(URL_PATTERN) .withLanguage(YAMLLanguage.INSTANCE); }
Example #10
Source File: FileDetector.java From intellij-swagger with MIT License | 5 votes |
private boolean hasYamlRootKey( final PsiFile psiFile, final String lookupKey, final String lookupVersion) { final Language language = psiFile.getLanguage(); if (!YAMLLanguage.INSTANCE.is(language)) { return false; } return new PathFinder() .findByPathFrom(lookupKey, psiFile) .filter(psiElement -> hasVersion(psiElement, lookupVersion)) .isPresent(); }
Example #11
Source File: YamlCompletionContributor.java From intellij-neos with GNU General Public License v3.0 | 5 votes |
protected PsiElementPattern.Capture<PsiElement> getNodeTypeElementMatcher(@NotNull String... keys) { return PlatformPatterns .psiElement() .with(new ParentKeysPatternCondition(keys)) .with(new FilenamePrefixPatternCondition("NodeTypes.")) .withLanguage(YAMLLanguage.INSTANCE); }
Example #12
Source File: YamlCompletionContributor.java From intellij-spring-assistant with MIT License | 4 votes |
public YamlCompletionContributor() { extend(CompletionType.BASIC, PlatformPatterns.psiElement().withLanguage(YAMLLanguage.INSTANCE), new YamlCompletionProvider()); }
Example #13
Source File: YamlElementPatternHelper.java From idea-php-symfony2-plugin with MIT License | 4 votes |
/** * simplified getFilterOnPrevParent :) * * services: * foo.name: * "complete": foo */ public static ElementPattern<PsiElement> getSuperParentArrayKey(String... tree) { return PlatformPatterns.or( // foo: // <caret> (on incomplete) PlatformPatterns.psiElement().afterLeaf( PlatformPatterns.psiElement(YAMLTokenTypes.INDENT).withParent( PlatformPatterns.psiElement(YAMLKeyValue.class).withParent( PlatformPatterns.psiElement(YAMLMapping.class).withParent( PlatformPatterns.psiElement(YAMLKeyValue.class).withName(PlatformPatterns .string().oneOfIgnoreCase(tree) ) ) ) ) ), /** * services: * foo: * cla<caret>: */ PlatformPatterns.psiElement().withParent( PlatformPatterns.psiElement(YAMLScalar.class).withParent( PlatformPatterns.psiElement(YAMLMapping.class).withParent( PlatformPatterns.psiElement(YAMLKeyValue.class).withParent( PlatformPatterns.psiElement(YAMLMapping.class).withParent( PlatformPatterns.psiElement(YAMLKeyValue.class).withName(PlatformPatterns .string().oneOfIgnoreCase(tree) ) ) ) ) ) ), // match // // tree: // xxx: // refer|: xxx PlatformPatterns .psiElement(YAMLTokenTypes.SCALAR_KEY) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withParent(PlatformPatterns .psiElement(YAMLMapping.class) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withParent(PlatformPatterns .psiElement(YAMLMapping.class) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withName(PlatformPatterns .string().oneOfIgnoreCase(tree) ) ) ) ) ) ) .withLanguage(YAMLLanguage.INSTANCE) ); }
Example #14
Source File: YamlElementPatternHelper.java From idea-php-symfony2-plugin with MIT License | 4 votes |
/** * provides auto complete on * * tree: * xxx: * refer| * refer|: xxx * refer| */ public static ElementPattern<PsiElement> getFilterOnPrevParent(String... tree) { return PlatformPatterns.or( // match // // tree: // xxx: // refer|: xxx PlatformPatterns .psiElement(YAMLTokenTypes.SCALAR_KEY) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withParent(PlatformPatterns .psiElement(YAMLCompoundValue.class) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withParent(PlatformPatterns .psiElement(YAMLCompoundValue.class) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withName(PlatformPatterns .string().oneOfIgnoreCase(tree) ) ) ) ) ) ) .inFile(getOrmFilePattern()) .withLanguage(YAMLLanguage.INSTANCE), // match // // tree: // xxx: // xxx: xxx // refer| PlatformPatterns .psiElement(YAMLPlainTextImpl.class) .withParent(PlatformPatterns .psiElement(YAMLCompoundValue.class) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withParent(PlatformPatterns .psiElement(YAMLCompoundValue.class) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withName(PlatformPatterns .string().oneOfIgnoreCase(tree) ) ) ) ) ) .inFile(getOrmFilePattern()) .withLanguage(YAMLLanguage.INSTANCE), // match // // tree: // xxx: // refer| // xxx: xxx PlatformPatterns .psiElement(YAMLPlainTextImpl.class) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withParent(PlatformPatterns .psiElement(YAMLCompoundValue.class) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withName(PlatformPatterns .string().oneOfIgnoreCase(tree) ) ) ) ) .inFile(getOrmFilePattern()) .withLanguage(YAMLLanguage.INSTANCE) ); }
Example #15
Source File: YamlElementPatternHelper.java From idea-php-symfony2-plugin with MIT License | 4 votes |
public static ElementPattern<PsiElement> getWithFirstRootKey() { return PlatformPatterns.or( // foo: // <caret> PlatformPatterns .psiElement().with(new ParentPathPatternCondition( YAMLScalar.class, YAMLMapping.class, YAMLKeyValue.class, YAMLMapping.class, YAMLDocument.class )) .withLanguage(YAMLLanguage.INSTANCE), // foo: // <caret> (on incomplete) PlatformPatterns .psiElement().afterLeaf( PlatformPatterns.psiElement(YAMLTokenTypes.INDENT).with( new ParentPathPatternCondition(YAMLKeyValue.class, YAMLMapping.class, YAMLDocument.class) ) ) .withLanguage(YAMLLanguage.INSTANCE), // match // // foo: // <caret>: bar // <caret>: // <caret>a: PlatformPatterns .psiElement().with(new ParentPathPatternCondition( YAMLScalar.class, YAMLKeyValue.class, YAMLMapping.class, YAMLKeyValue.class, YAMLMapping.class, YAMLDocument.class) ) .withLanguage(YAMLLanguage.INSTANCE), // foo: // fo<caret>: PlatformPatterns.psiElement().with(new ParentPathPatternCondition( YAMLKeyValue.class, YAMLMapping.class, YAMLKeyValue.class, YAMLMapping.class, YAMLDocument.class) ) ); }
Example #16
Source File: YamlElementPatternHelper.java From idea-php-symfony2-plugin with MIT License | 4 votes |
/** * provides auto complete on * * keyName: * refer| * refer|: xxx * refer| * * @param keyName key name */ public static ElementPattern<PsiElement> getParentKeyName(String keyName) { return PlatformPatterns.or( // match // // keyName: // refer|: xxx PlatformPatterns .psiElement(YAMLTokenTypes.SCALAR_KEY) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withParent(PlatformPatterns .psiElement(YAMLCompoundValue.class) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withName( PlatformPatterns.string().equalTo(keyName) ) ) ) ) .withLanguage(YAMLLanguage.INSTANCE), // match // // keyName: // xxx: xxx // refer| PlatformPatterns .psiElement(YAMLPlainTextImpl.class) .withParent(PlatformPatterns .psiElement(YAMLCompoundValue.class) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withName( PlatformPatterns.string().equalTo(keyName) ) ) ) .withLanguage(YAMLLanguage.INSTANCE), // match // // keyName: // refer| // xxx: xxx getKeyPattern(keyName) .withLanguage(YAMLLanguage.INSTANCE) ); }
Example #17
Source File: YamlElementPatternHelper.java From idea-php-symfony2-plugin with MIT License | 4 votes |
/** * provides auto complete on * * keyName: * refer| * refer|: xxx * refer| * * @param keyName key name */ public static ElementPattern<PsiElement> getOrmParentLookup(String keyName) { return PlatformPatterns.or( // match // // keyName: // refer|: xxx PlatformPatterns .psiElement(YAMLTokenTypes.SCALAR_KEY) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withParent(PlatformPatterns .psiElement(YAMLCompoundValue.class) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withName( PlatformPatterns.string().equalTo(keyName) ) ) ) ) .inFile(getOrmFilePattern()) .withLanguage(YAMLLanguage.INSTANCE), // match // // keyName: // xxx: xxx // refer| PlatformPatterns .psiElement(YAMLPlainTextImpl.class) .withParent(PlatformPatterns .psiElement(YAMLCompoundValue.class) .withParent(PlatformPatterns .psiElement(YAMLKeyValue.class) .withName( PlatformPatterns.string().equalTo(keyName) ) ) ) .inFile(getOrmFilePattern()) .withLanguage(YAMLLanguage.INSTANCE), // match // // keyName: // refer| // xxx: xxx getKeyPattern(keyName) .inFile(getOrmFilePattern()) .withLanguage(YAMLLanguage.INSTANCE) ); }
Example #18
Source File: Unity3dMetaFileType.java From consulo-unity3d with Apache License 2.0 | 4 votes |
public Unity3dMetaFileType() { super(YAMLLanguage.INSTANCE); }
Example #19
Source File: Unity3dYMLAssetFileType.java From consulo-unity3d with Apache License 2.0 | 4 votes |
private Unity3dYMLAssetFileType() { super(YAMLLanguage.INSTANCE); }
Example #20
Source File: KubernetesYamlCompletionContributor.java From intellij-kubernetes with Apache License 2.0 | 4 votes |
/** Default constructor. */ public KubernetesYamlCompletionContributor() { extend(CompletionType.BASIC, PlatformPatterns.psiElement().withLanguage(YAMLLanguage.INSTANCE), new Provider()); }
Example #21
Source File: KubernetesYamlFileType.java From intellij-kubernetes with Apache License 2.0 | 4 votes |
/** Singleton default constructor. */ private KubernetesYamlFileType() { super(YAMLLanguage.INSTANCE); }
Example #22
Source File: YamlReferenceContributor.java From intellij-swagger with MIT License | 4 votes |
private PsiElementPattern.Capture<YAMLValue> filePattern() { return psiElement(YAMLValue.class) .withText(FILE_NAME_PATTERN) .withoutText(URL_PATTERN) .withLanguage(YAMLLanguage.INSTANCE); }
Example #23
Source File: YamlElementPatternHelper.java From idea-php-symfony2-plugin with MIT License | 2 votes |
/** * auto complete on * * keyName: refer| * * @param keyName */ public static ElementPattern<PsiElement> getOrmSingleLineScalarKey(String... keyName) { return getKeyPattern(keyName).inFile(getOrmFilePattern()).withLanguage(YAMLLanguage.INSTANCE); }