當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。