Java Code Examples for com.intellij.codeInsight.completion.CompletionContributor#extend()

The following examples show how to use com.intellij.codeInsight.completion.CompletionContributor#extend() . 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: CSharpLinqCompletionContributor.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
static void extend(CompletionContributor contributor)
{
	contributor.extend(CompletionType.BASIC, CSharpPatterns.expressionStart(), new CompletionProvider()
	{
		@RequiredReadAction
		@Override
		public void addCompletions(@Nonnull CompletionParameters parameters, ProcessingContext context, @Nonnull CompletionResultSet result)
		{
			PsiElement position = parameters.getPosition();
			if(!CSharpModuleUtil.findLanguageVersion(position).isAtLeast(CSharpLanguageVersion._3_0))
			{
				return;
			}
			CSharpReferenceExpressionEx parent = (CSharpReferenceExpressionEx) position.getParent();
			if(parent.getQualifier() != null || parent.kind() != CSharpReferenceExpression.ResolveToKind.ANY_MEMBER)
			{
				return;
			}

			CSharpCompletionUtil.elementToLookup(result, CSharpSoftTokens.FROM_KEYWORD, null, null);
		}
	});
}
 
Example 2
Source File: CommandNameCompletionProvider.java    From BashSupport with Apache License 2.0 5 votes vote down vote up
@Override
void addTo(CompletionContributor contributor) {
    BashPsiPattern internal = new BashPsiPattern().withParent(BashInternalCommand.class);
    BashPsiPattern generic = new BashPsiPattern().withParent(BashGenericCommand.class);
    ElementPattern<PsiElement> internalOrGeneric = StandardPatterns.or(internal, generic);

    BashPsiPattern pattern = new BashPsiPattern().withParent(internalOrGeneric);

    contributor.extend(CompletionType.BASIC, pattern, this);
}
 
Example 3
Source File: BashKeywordCompletionProvider.java    From BashSupport with Apache License 2.0 4 votes vote down vote up
void addTo(CompletionContributor contributor) {
    contributor.extend(CompletionType.BASIC, KEYWORD_PATTERN, this);
}
 
Example 4
Source File: ShebangPathCompletionProvider.java    From BashSupport with Apache License 2.0 4 votes vote down vote up
@Override
void addTo(CompletionContributor contributor) {
    contributor.extend(CompletionType.BASIC, new BashPsiPattern().inside(BashShebang.class), this);
}
 
Example 5
Source File: VariableNameCompletionProvider.java    From BashSupport with Apache License 2.0 4 votes vote down vote up
@Override
void addTo(CompletionContributor contributor) {
    BashPsiPattern insideVar = new BashPsiPattern().withParent(BashVar.class);

    contributor.extend(CompletionType.BASIC, insideVar, this);
}
 
Example 6
Source File: DynamicPathCompletionProvider.java    From BashSupport with Apache License 2.0 4 votes vote down vote up
@Override
void addTo(CompletionContributor contributor) {
    contributor.extend(CompletionType.BASIC, new BashPsiPattern().withParent(BashWord.class), this);
}