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


Java CompletionInitializationContext类代码示例

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


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

示例1: patternForVariableAssignment

import com.intellij.codeInsight.completion.CompletionInitializationContext; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static ElementPattern<PsiElement> patternForVariableAssignment() {
  final ElementPattern<PsiElement> patternForParent = or(psiElement().withText(CompletionInitializationContext.DUMMY_IDENTIFIER_TRIMMED)
                                                           .afterSiblingSkipping(psiElement(PsiWhiteSpace.class),
                                                                                 psiElement(PsiJavaToken.class).withText("=")));

  return psiElement().withParent(patternForParent).withSuperParent(2, or(psiElement(PsiAssignmentExpression.class),
                                                                         psiElement(PsiLocalVariable.class)
                                                                           .inside(PsiDeclarationStatement.class)))
                                                                           .inside(PsiMethod.class);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:CompletionContributorPatternUtil.java

示例2: createInsertionContext

import com.intellij.codeInsight.completion.CompletionInitializationContext; //导入依赖的package包/类
private static InsertionContext createInsertionContext(LookupElement item,
                                                       PsiFile psiFile,
                                                       List<? extends LookupElement> elements,
                                                       Editor editor, final char completionChar) {
  final OffsetMap offsetMap = new OffsetMap(editor.getDocument());
  final InsertionContext context = new InsertionContext(offsetMap, completionChar, elements.toArray(new LookupElement[elements.size()]), psiFile, editor, false);
  context.setTailOffset(editor.getCaretModel().getOffset());
  offsetMap.addOffset(CompletionInitializationContext.START_OFFSET, context.getTailOffset() - item.getLookupString().length());
  offsetMap.addOffset(CompletionInitializationContext.SELECTION_END_OFFSET, context.getTailOffset());
  offsetMap.addOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET, context.getTailOffset());
  return context;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:TemplateExpressionLookupElement.java

示例3: getText

import com.intellij.codeInsight.completion.CompletionInitializationContext; //导入依赖的package包/类
private String getText() {
  PsiElement element = PsiTreeUtil.getParentOfType(getElement(), PyFile.class);
  if (element != null) {
    return element.getText().replace(CompletionInitializationContext.DUMMY_IDENTIFIER, "");
  }
  return myPrefix;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PydevConsoleReference.java

示例4: setCorrectCase

import com.intellij.codeInsight.completion.CompletionInitializationContext; //导入依赖的package包/类
@NotNull
private String setCorrectCase() {
  final PsiElement element = myContext.getFile().findElementAt(myContext.getStartOffset());
  if (element == null) return DUMMY_IDENTIFIER_DECAPITALIZED;

  final String text = element.getText();
  if (text.isEmpty()) return DUMMY_IDENTIFIER_DECAPITALIZED;

  return Character.isUpperCase(text.charAt(0)) ? CompletionInitializationContext.DUMMY_IDENTIFIER : DUMMY_IDENTIFIER_DECAPITALIZED;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:GrDummyIdentifierProvider.java

示例5: beforeCompletion

import com.intellij.codeInsight.completion.CompletionInitializationContext; //导入依赖的package包/类
@Override
public void beforeCompletion(@NotNull CompletionInitializationContext context)
{

	context.setDummyIdentifier(CompletionInitializationContext.DUMMY_IDENTIFIER.trim() + ";");

	//        final PsiFile file = context.getFile();
	//
	//        final char c1 = file.getText().charAt(context.getStartOffset() - 1);
	//        if (c1 == ':' || c1 == '.') {
	//
	//            final PsiReference e = file.findReferenceAt(context.getStartOffset() - 2);
	//
	//            if (e != null) {
	//                int newStart = context.getStartOffset();
	//
	//                if (e.getElement() instanceof LuaCompoundIdentifier) {
	//                    LuaCompoundIdentifier c = (LuaCompoundIdentifier) e.getElement();
	//
	//                    LuaExpression s = c.getLeftSymbol();
	//                    if (s != null)
	//                        newStart = s.getTextOffset();
	//                } else {
	//                    if (e.getElement() instanceof LuaIdentifier)
	//                        newStart = e.getElement().getTextOffset();
	//                }
	//                context.getOffsetMap().addOffset(IDENTIFIER_START_OFFSET, newStart);
	//            }
	//        }
}
 
开发者ID:consulo,项目名称:consulo-lua,代码行数:31,代码来源:LuaCompletionContributor.java

示例6: suggestKeywordsBasedOnParserExpectedKeywords

import com.intellij.codeInsight.completion.CompletionInitializationContext; //导入依赖的package包/类
@NotNull
private Collection<String> suggestKeywordsBasedOnParserExpectedKeywords(@NotNull PsiElement position) {
    String text = getPrecedingText(position, CompletionInitializationContext.DUMMY_IDENTIFIER);
    Project project = position.getProject();
    PsiFile temporaryFileForCompletionCheck = createFileForText(project, text + "          ");
    int completionOffset = calculateCompletionOffset(position);
    GeneratedParserUtilBase.CompletionState completionStateInTemporaryFile = getCompletionStateForKeywords(completionOffset);
    temporaryFileForCompletionCheck.putUserData(COMPLETION_STATE_KEY, completionStateInTemporaryFile);
    triggerParsingInFile(temporaryFileForCompletionCheck);
    List<String> stripped = stringPrecedingText(StringUtils.normalizeWhitespaces(text), completionStateInTemporaryFile.items);
    return expandMultiWordOptions(stripped);
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:13,代码来源:KeywordCollector.java

示例7: beforeCompletion

import com.intellij.codeInsight.completion.CompletionInitializationContext; //导入依赖的package包/类
@Override
public void beforeCompletion(@NotNull CompletionInitializationContext context)
{
	int offset = context.getStartOffset();
	if(offset == 0 || !context.getFile().getViewProvider().getLanguages().contains(VtlLanguage.INSTANCE))
	{
		return;
	}
	final CharSequence chars = context.getEditor().getDocument().getCharsSequence();
	char currChar;
	do
	{
		currChar = chars.charAt(--offset);
	}
	while(offset > 0 && (Character.isLetterOrDigit(currChar) || currChar == '-' || currChar == '_'));
	String dummyId;
	if(currChar == '#')
	{
		dummyId = "dummyId()";
	}
	else if(currChar == '{' && offset > 0 && chars.charAt(offset - 1) == '#')
	{
		dummyId = "dummyId}()";
	}
	else
	{
		boolean upperCase = offset + 1 < chars.length() && Character.isUpperCase(chars.charAt(offset + 1));
		dummyId = upperCase ? "DummyId" : "dummyId";
	}
	context.setDummyIdentifier(dummyId);
}
 
开发者ID:consulo,项目名称:consulo-apache-velocity,代码行数:32,代码来源:VtlCompletionContributor.java

示例8: isSemicolonNeeded

import com.intellij.codeInsight.completion.CompletionInitializationContext; //导入依赖的package包/类
private static boolean isSemicolonNeeded(@NotNull PsiFile file, @NotNull Editor editor) {
	return JavaCompletionContributor.semicolonNeeded(editor, file, CompletionInitializationContext.calcStartOffset(editor.getCaretModel().getCurrentCaret()));
}
 
开发者ID:xylo,项目名称:intellij-postfix-templates,代码行数:4,代码来源:CustomPostfixTemplateProvider.java

示例9: isSemicolonNeeded

import com.intellij.codeInsight.completion.CompletionInitializationContext; //导入依赖的package包/类
private static boolean isSemicolonNeeded(@NotNull PsiFile file, @NotNull Editor editor) {
  return JavaCompletionContributor.semicolonNeeded(editor, file, CompletionInitializationContext.calcStartOffset(editor.getCaretModel().getCurrentCaret()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:JavaPostfixTemplateProvider.java

示例10: GrDummyIdentifierProvider

import com.intellij.codeInsight.completion.CompletionInitializationContext; //导入依赖的package包/类
public GrDummyIdentifierProvider(@NotNull CompletionInitializationContext context) {
  myContext = context;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:GrDummyIdentifierProvider.java

示例11: matches

import com.intellij.codeInsight.completion.CompletionInitializationContext; //导入依赖的package包/类
public boolean matches(XmlTag element) {
  final String s = element.getAttributeValue("mode");
  return myMode != null &&
         s != null && s.indexOf(CompletionInitializationContext.DUMMY_IDENTIFIER_TRIMMED) == -1 &&
         super.matches(element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ModeReference.java

示例12: beforeCompletion

import com.intellij.codeInsight.completion.CompletionInitializationContext; //导入依赖的package包/类
@Override
public void beforeCompletion(@NotNull CompletionInitializationContext context)
{
	context.setDummyIdentifier(CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED);
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:6,代码来源:CSharpCompletionContributor.java

示例13: trimDummy

import com.intellij.codeInsight.completion.CompletionInitializationContext; //导入依赖的package包/类
private static String trimDummy(String text) {
  if (text.endsWith(CompletionInitializationContext.DUMMY_IDENTIFIER_TRIMMED)) {
    text = text.substring(0, text.length() - CompletionInitializationContext.DUMMY_IDENTIFIER_TRIMMED.length());
  }
  return text;
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:7,代码来源:HaxeCodeGenerateUtil.java

示例14: duringCompletion

import com.intellij.codeInsight.completion.CompletionInitializationContext; //导入依赖的package包/类
@Override
public void duringCompletion(@NotNull CompletionInitializationContext context)
{
	super.duringCompletion(context);
}
 
开发者ID:consulo,项目名称:consulo-lua,代码行数:6,代码来源:LuaCompletionContributor.java

示例15: beforeCompletion

import com.intellij.codeInsight.completion.CompletionInitializationContext; //导入依赖的package包/类
@Override
public void beforeCompletion(@NotNull CompletionInitializationContext context) {
    overwriteDummyIdentifierToTryToCreateFunctionReference(context);
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:5,代码来源:XQueryCompletionContributor.java


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