当前位置: 首页>>代码示例>>Java>>正文


Java CompletionParameters.getCompletionType方法代码示例

本文整理汇总了Java中com.intellij.codeInsight.completion.CompletionParameters.getCompletionType方法的典型用法代码示例。如果您正苦于以下问题:Java CompletionParameters.getCompletionType方法的具体用法?Java CompletionParameters.getCompletionType怎么用?Java CompletionParameters.getCompletionType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.codeInsight.completion.CompletionParameters的用法示例。


在下文中一共展示了CompletionParameters.getCompletionType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: delegate

import com.intellij.codeInsight.completion.CompletionParameters; //导入方法依赖的package包/类
@RequiredReadAction
private static void delegate(CompletionParameters parameters, final CompletionResultSet result, final InheritorsHolder inheritorsHolder)
{
	if(parameters.getCompletionType() == CompletionType.BASIC)
	{
		PsiElement position = parameters.getPosition();
		if(parameters.getInvocationCount() <= 1 && CSharpCompletionUtil.mayStartClassName(result) && CSharpCompletionUtil.isClassNamePossible(parameters))
		{
			addTypesForUsing(parameters, result, inheritorsHolder);
			return;
		}

		//suggestChainedCalls(parameters, result, position);
	}

	if(parameters.getCompletionType() == CompletionType.SMART && parameters.getInvocationCount() == 2)
	{
		result.runRemainingContributors(parameters.withInvocationCount(3), true);
	}
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:21,代码来源:CSharpNoVariantsDelegator.java

示例2: fillCompletionVariants

import com.intellij.codeInsight.completion.CompletionParameters; //导入方法依赖的package包/类
@Override
public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result)
{
	if(parameters.getCompletionType() != CompletionType.BASIC)
	{
		return;
	}

	final PsiElement position = parameters.getPosition();
	if(!isInJavaContext(position))
	{
		return;
	}

	if(BEGINNING_OF_ANNOTATION_ARGUMENTS.accepts(position))
	{
		addVariants(position, (psiClass, isDeclared) -> addAnnotationClasses(psiClass, isDeclared, result));
		//TODO handle annotations on fields and methods
	}
	else if(BEGINNING_OF_CONSTRUCTOR_ARGUMENTS.accepts(position))
	{
		addVariants(position, (psiClass, isDeclared) -> addConstructorParameterTypes(psiClass, isDeclared, result));
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:25,代码来源:JavaReflectionCompletionContributor.java

示例3: fillCompletionVariants

import com.intellij.codeInsight.completion.CompletionParameters; //导入方法依赖的package包/类
@Override
public void fillCompletionVariants(@NotNull final CompletionParameters parameters, @NotNull CompletionResultSet result) {
  if (parameters.getCompletionType() != CompletionType.SMART) return;

  Collection<?> variants = getVariants(parameters);

  MavenPropertyCompletionContributor.addVariants(variants, result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:MavenSmartCompletionContributor.java

示例4: fillCompletionVariants

import com.intellij.codeInsight.completion.CompletionParameters; //导入方法依赖的package包/类
@Override
public void fillCompletionVariants(final CompletionParameters parameters, CompletionResultSet result) {
  if (parameters.getCompletionType() != CompletionType.SMART) return;

  Collection<?> variants = getVariants(parameters);

  MavenPropertyCompletionContributor.addVariants(variants, result);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:MavenSmartCompletionContributor.java

示例5: shouldFocusLookup

import com.intellij.codeInsight.completion.CompletionParameters; //导入方法依赖的package包/类
@NotNull
@Override
public ThreeState shouldFocusLookup(@NotNull CompletionParameters parameters) {
    if (parameters.getCompletionType() == CompletionType.SMART)
        return ThreeState.YES;

    return ThreeState.UNSURE;
}
 
开发者ID:consulo,项目名称:consulo-lua,代码行数:9,代码来源:LuaCompletionConfidence.java

示例6: decorate

import com.intellij.codeInsight.completion.CompletionParameters; //导入方法依赖的package包/类
private static LookupElement decorate(CompletionParameters parameters, List<ExpectedTypeInfo> types, LookupElement element)
{
	if(!types.isEmpty() && parameters.getCompletionType() == CompletionType.SMART)
	{
		element = JavaSmartCompletionContributor.decorate(element, types);
	}
	return element;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:9,代码来源:MagicCompletionContributor.java

示例7: JSGraphQLEndpointCompletionContributor

import com.intellij.codeInsight.completion.CompletionParameters; //导入方法依赖的package包/类
public JSGraphQLEndpointCompletionContributor() {

		CompletionProvider<CompletionParameters> provider = new CompletionProvider<CompletionParameters>() {
			@Override
			protected void addCompletions(@NotNull final CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {

				final PsiFile file = parameters.getOriginalFile();

				if (!(file instanceof JSGraphQLEndpointFile)) {
					return;
				}

				final boolean autoImport = parameters.isExtendedCompletion() || parameters.getCompletionType() == CompletionType.SMART;

				final PsiElement completionElement = Optional.ofNullable(parameters.getOriginalPosition()).orElse(parameters.getPosition());
				if (completionElement != null) {

					final PsiElement parent = completionElement.getParent();
					final PsiElement leafBeforeCompletion = PsiTreeUtil.prevVisibleLeaf(completionElement);

					// 1. complete on interface name after IMPLEMENTS token
					if (completeImplementableInterface(result, autoImport, completionElement, leafBeforeCompletion)) {
						return;
					}

					// 2. import file
					if (completeImportFile(result, file, parent)) {
						return;
					}

					// 3.A. top level completions, e.g. keywords
					if (completeKeywords(result, completionElement, leafBeforeCompletion, parent)) {
						return;
					}

					// 3.B. implements when type definition surrounds completion element (e.g. when it has a FieldDefinitionSet)
					if (completeImplementsInsideTypeDefinition(result, completionElement, parent)) {
						return;
					}

					// 4. completions inside FieldDefinitionSet
					final JSGraphQLEndpointFieldDefinitionSet fieldDefinitionSet = PsiTreeUtil.getParentOfType(completionElement, JSGraphQLEndpointFieldDefinitionSet.class);
					if (fieldDefinitionSet != null) {

						// 4.A. field/argument type completion
						if (completeFieldOrArgumentType(result, autoImport, completionElement)) {
							return;
						}

						// 4.B. annotations
						if (completeAnnotations(result, file, completionElement)) {
							return;
						}

						// 4.C. annotation arguments
						if (completeAnnotationArguments(result, file, completionElement, leafBeforeCompletion)) {
							return;
						}

						// 4.D. override for interface fields
						if (completeOverrideFields(fieldDefinitionSet, completionElement, result)) {
							return;
						}
					}

					// 5. completions inside SchemaDefinition
					if (completeInsideSchemaDefinition(result, completionElement, leafBeforeCompletion)) {
						return;
					}

				}

			}
		};

		extend(CompletionType.BASIC, PlatformPatterns.psiElement(), provider);
		extend(CompletionType.SMART, PlatformPatterns.psiElement(), provider);

	}
 
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:80,代码来源:JSGraphQLEndpointCompletionContributor.java

示例8: fillCompletionVariants

import com.intellij.codeInsight.completion.CompletionParameters; //导入方法依赖的package包/类
@RequiredReadAction
@RequiredDispatchThread
public static void fillCompletionVariants(CompletionParameters parameters, CompletionResultSet result)
{
	final InheritorsHolder holder = new InheritorsHolder(result);
	ResultTracker tracker = new ResultTracker(result)
	{
		@Override
		public void consume(CompletionResult plainResult)
		{
			super.consume(plainResult);

			LookupElement element = plainResult.getLookupElement();
			Object o = element.getObject();
			if(o instanceof PsiElement && CSharpPsiUtilImpl.isTypeLikeElement((PsiElement) o))
			{
				holder.registerTypeLike((DotNetQualifiedElement) o);
			}
		}
	};
	result.runRemainingContributors(parameters, tracker);
	final boolean empty = tracker.containsOnlyNamespaces;

	if(!empty && parameters.getInvocationCount() == 0)
	{
		result.restartCompletionWhenNothingMatches();
	}

	if(empty)
	{
		delegate(parameters, result, holder);
	}
	else
	{
		if(parameters.getCompletionType() == CompletionType.BASIC && parameters.getInvocationCount() <= 1 && CSharpCompletionUtil.mayStartClassName(result) && CSharpCompletionUtil
				.isClassNamePossible(parameters))
		{
			addTypesForUsing(parameters, result.withPrefixMatcher(tracker.betterMatcher), holder);
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:42,代码来源:CSharpNoVariantsDelegator.java


注:本文中的com.intellij.codeInsight.completion.CompletionParameters.getCompletionType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。