com.intellij.lang.parser.GeneratedParserUtilBase Java Examples
The following examples show how to use
com.intellij.lang.parser.GeneratedParserUtilBase.
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: ElmMainCompletionProvider.java From elm-plugin with MIT License | 6 votes |
@Override protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext processingContext, @NotNull CompletionResultSet resultSet) { PsiElement position = parameters.getPosition(); PsiElement parent = position.getParent(); PsiElement grandParent = Optional.ofNullable(parent) .map(PsiElement::getParent) .orElse(null); if (parent instanceof ElmFile || parent instanceof GeneratedParserUtilBase.DummyBlock) { addCompletionsInInvalidExpression(position, resultSet); } else if (grandParent instanceof ElmLowerCasePath) { this.addValueOrFieldCompletions((ElmLowerCaseId) parent, resultSet); } else if (grandParent instanceof ElmMixedCasePath || grandParent instanceof ElmUpperCasePath) { addTypeOrModuleCompletions(parent, resultSet); } else if (grandParent instanceof ElmExposingClause) { this.addExposedValuesCompletion((ElmExposingClause)grandParent, resultSet); } else if (parent instanceof ElmUpperCaseId) { this.addExposedValuesCompletion((ElmUpperCaseId)parent, resultSet); } else if (parent instanceof ElmLowerCaseId && grandParent instanceof ElmModuleDeclaration) { this.singleModuleValueProvider.addCompletions((ElmFile)grandParent.getContainingFile(), resultSet); } }
Example #2
Source File: CaseOfParser.java From elm-plugin with MIT License | 5 votes |
public CaseOfParser( GeneratedParserUtilBase.Parser header, GeneratedParserUtilBase.Parser branch, GeneratedParserUtilBase.Parser oneOrMoreSeparations ) { this.header = header; this.branch = branch; this.oneOrMoreSeparations = oneOrMoreSeparations; }
Example #3
Source File: ThriftKeywordCompletionContributor.java From intellij-thrift with Apache License 2.0 | 5 votes |
private Collection<String> suggestKeywords(@NotNull PsiElement position) { PsiFile psiFile = position.getContainingFile(); PsiElement topLevelElement = position; while (!(topLevelElement.getParent() instanceof PsiFile)) { topLevelElement = topLevelElement.getParent(); } PsiFile file = PsiFileFactory.getInstance(psiFile.getProject()) .createFileFromText("a.thrift", ThriftLanguage.INSTANCE, topLevelElement.getText(), true, false); GeneratedParserUtilBase.CompletionState state = new GeneratedParserUtilBase.CompletionState(position.getTextOffset() - topLevelElement.getTextOffset()); file.putUserData(GeneratedParserUtilBase.COMPLETION_STATE_KEY, state); TreeUtil.ensureParsed(file.getNode()); return state.items; }
Example #4
Source File: XPath.java From antlr4-intellij-adaptor with BSD 2-Clause "Simplified" License | 4 votes |
public DummyRoot(PsiElement child) { super(GeneratedParserUtilBase.DUMMY_BLOCK); this.child = child; }