本文整理匯總了Java中com.intellij.codeInsight.completion.CompletionResultSet類的典型用法代碼示例。如果您正苦於以下問題:Java CompletionResultSet類的具體用法?Java CompletionResultSet怎麽用?Java CompletionResultSet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CompletionResultSet類屬於com.intellij.codeInsight.completion包,在下文中一共展示了CompletionResultSet類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: extendWithTemplateDefinitionLevelKeywords
import com.intellij.codeInsight.completion.CompletionResultSet; //導入依賴的package包/類
/**
* Complete the "visibility" and "stricthtml" keywords in template definition open tags.
*/
private void extendWithTemplateDefinitionLevelKeywords() {
extend(
CompletionType.BASIC,
psiElement().andOr(psiElement().inside(SoyBeginTemplate.class)),
new CompletionProvider<CompletionParameters>() {
@Override
protected void addCompletions(
@NotNull CompletionParameters completionParameters,
ProcessingContext processingContext,
@NotNull CompletionResultSet completionResultSet) {
if (isPrecededBy(completionParameters.getPosition(),
elt -> elt instanceof SoyTemplateDefinitionIdentifier)) {
completionResultSet.addElement(
LookupElementBuilder.create("visibility=\"private\""));
completionResultSet.addElement(
LookupElementBuilder.create("stricthtml=\"true\""));
}
}
});
}
示例2: addCompletions
import com.intellij.codeInsight.completion.CompletionResultSet; //導入依賴的package包/類
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {
List<TSVarExpr> variables = new ArrayList<>();
for (PsiElement current = parameters.getPosition().getPrevSibling(); current != null; current = current.getPrevSibling()) {
if (current.getNode().getElementType().equals(TSTypes.FUNCTION))
break;
if (current.getNode().getElementType().equals(TSTypes.LOCALVAR)) {
String prefixless = current.getText().substring(1);
result.addElement(
LookupElementBuilder.create(prefixless)
.withPresentableText(current.getText())
.withCaseSensitivity(false)
);
}
}
}
示例3: addCompletions
import com.intellij.codeInsight.completion.CompletionResultSet; //導入依賴的package包/類
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {
String namespace = parameters.getPosition().getPrevSibling().getPrevSibling().getText();
Project project = parameters.getOriginalFile().getProject();
Collection<TSFnDeclStmt> functions = TSUtil.getFunctionList(project);
for (TSFnDeclStmt function : functions) {
if (function.getFunctionType() == TSFunctionType.GLOBAL)
continue;
if (namespace != null && !function.getNamespace().equalsIgnoreCase(namespace))
continue;
result.addElement(
LookupElementBuilder.create(function.getFunctionName())
.withCaseSensitivity(false)
.withPresentableText(function.getNamespace() + "::" + function.getFunctionName())
.withTailText(function.getArgList())
.withInsertHandler(TSCaseCorrectingInsertHandler.INSTANCE)
);
}
}
示例4: addCompletions
import com.intellij.codeInsight.completion.CompletionResultSet; //導入依賴的package包/類
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {
//All global functions
Project project = parameters.getOriginalFile().getProject();
Collection<TSFnDeclStmt> functions = TSUtil.getFunctionList(project);
for (TSFnDeclStmt function : functions) {
if (function.getFunctionType() != TSFunctionType.GLOBAL)
continue;
result.addElement(
LookupElementBuilder.create(function)
.withCaseSensitivity(false)
.withTailText(function.getArgList())
.withInsertHandler(TSCaseCorrectingInsertHandler.INSTANCE)
);
}
}
示例5: complete
import com.intellij.codeInsight.completion.CompletionResultSet; //導入依賴的package包/類
static void complete(Project project, PsiModuleName name, @NotNull CompletionResultSet resultSet) {
// Get the correct module
Collection<PsiModule> modules = StubIndex.getElements(IndexKeys.MODULES, name.getName(), project, GlobalSearchScope.allScope(project), PsiModule.class);
if (!modules.isEmpty()) {
for (PsiModule module : modules) {
Collection<PsiNamedElement> expressions = module.getExpressions();
for (PsiNamedElement expression : expressions) {
resultSet.addElement(
LookupElementBuilder.create(expression).
withIcon(PsiIconUtil.getProvidersIcon(expression, 0)).
withTypeText(PsiInferredTypeUtil.getTypeInfo(expression))
);
}
}
}
}
示例6: addCompletions
import com.intellij.codeInsight.completion.CompletionResultSet; //導入依賴的package包/類
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet resultSet) {
MerlinService merlin = ApplicationManager.getApplication().getComponent(MerlinService.class);
PsiFile originalFile = parameters.getOriginalFile();
String text = originalFile.getText();
LineNumbering lineNumbering = new LineNumbering(text);
String suitablePrefix = findSuitablePrefix(parameters, text);
MerlinPosition position = lineNumbering.offsetToPosition(parameters.getOffset());
MerlinCompletion completion = merlin.completions(originalFile.getName(), text, position, suitablePrefix);
for (MerlinCompletionEntry entry : completion.entries) {
resultSet.addElement(LookupElementBuilder.
create(entry.name).
withIcon(getIcon(entry)).
withTypeText(entry.desc));
}
}
示例7: addCompletions
import com.intellij.codeInsight.completion.CompletionResultSet; //導入依賴的package包/類
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
ProcessingContext context,
@NotNull CompletionResultSet result) {
PsiElement position = parameters.getPosition().getOriginalElement();
if (position == null || !(position instanceof XmlElement)) {
return;
}
DiIndex diIndex = DiIndex.getInstance(position.getProject());
PhpClass phpClass = diIndex.getPhpClassOfArgument((XmlElement) position);
if (phpClass != null) {
Method constructor = phpClass.getConstructor();
if (constructor != null) {
for (Parameter parameter : constructor.getParameters()) {
result.addElement(
LookupElementBuilder
.create(parameter.getName())
.withIcon(parameter.getIcon())
);
}
}
}
}
開發者ID:magento,項目名稱:magento2-phpstorm-plugin,代碼行數:26,代碼來源:PhpConstructorArgumentCompletionProvider.java
示例8: addCompletions
import com.intellij.codeInsight.completion.CompletionResultSet; //導入依賴的package包/類
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
ProcessingContext context,
@NotNull CompletionResultSet result) {
PsiElement position = parameters.getPosition().getOriginalElement();
if (position == null) {
return;
}
Collection<String> keys = LayoutIndex.getAllKeys(ContainerNameIndex.KEY, position.getProject());
for (String key: keys) {
result.addElement(
LookupElementBuilder.create(key).withIcon(PhpIcons.XML_TAG_ICON)
);
}
}
示例9: addCompletions
import com.intellij.codeInsight.completion.CompletionResultSet; //導入依賴的package包/類
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
ProcessingContext context,
@NotNull CompletionResultSet result) {
PsiElement position = parameters.getPosition().getOriginalElement();
if (position == null) {
return;
}
String prefix = result.getPrefixMatcher().getPrefix();
Collection<String> moduleNames
= FileBasedIndex.getInstance().getAllKeys(ModuleNameIndex.KEY, position.getProject());
moduleNames.removeIf(m -> !m.startsWith(prefix));
for (String moduleName : moduleNames) {
result.addElement(
LookupElementBuilder
.create(moduleName)
.withIcon(AllIcons.Modules.ModulesNode)
);
}
}
示例10: addCompletions
import com.intellij.codeInsight.completion.CompletionResultSet; //導入依賴的package包/類
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
ProcessingContext context,
@NotNull CompletionResultSet result) {
PsiElement position = parameters.getPosition().getOriginalElement();
if (position == null) {
return;
}
Collection<String> keys = LayoutIndex.getAllKeys(BlockNameIndex.KEY, position.getProject());
for (String key: keys) {
result.addElement(
LookupElementBuilder.create(key).withIcon(PhpIcons.XML_TAG_ICON)
);
}
}
示例11: addCompletions
import com.intellij.codeInsight.completion.CompletionResultSet; //導入依賴的package包/類
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
ProcessingContext context,
@NotNull CompletionResultSet result) {
PsiElement position = parameters.getPosition().getOriginalElement();
if (position == null) {
return;
}
String prefix = result.getPrefixMatcher().getPrefix();
DiIndex index = DiIndex.getInstance(position.getProject());
Collection<String> elements = index.getAllVirtualTypeElementNames(new PlainPrefixMatcher(prefix), position.getResolveScope());
for (String elementName:elements) {
result.addElement(
LookupElementBuilder
.create(elementName)
.withIcon(PhpIcons.CLASS_ICON)
);
}
}
示例12: findViewVfs
import com.intellij.codeInsight.completion.CompletionResultSet; //導入依賴的package包/類
private Collection<VirtualFile> findViewVfs(CompletionParameters parameters, CompletionResultSet result)
{
Collection<VirtualFile> viewVfs = new ArrayList<>();
Pattern pattern = Pattern.compile(RegExUtil.Magento.MODULE_NAME);
Matcher matcher = pattern.matcher(result.getPrefixMatcher().getPrefix());
if (matcher.find()) {
viewVfs.addAll(
FileBasedIndexUtil.findViewVfsByModuleName(matcher.group(0), parameters.getPosition().getProject())
);
} else {
VirtualFile moduleVf =
VfsUtil.findVfUp(parameters.getOriginalFile().getVirtualFile(), "registration.php");
viewVfs.addAll(
FileBasedIndexUtil.findViewVfsByModuleVf(moduleVf, parameters.getPosition().getProject())
);
}
return viewVfs;
}
示例13: addCompletions
import com.intellij.codeInsight.completion.CompletionResultSet; //導入依賴的package包/類
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
ProcessingContext context,
@NotNull CompletionResultSet result) {
PsiElement position = parameters.getPosition().getOriginalElement();
if (position == null) {
return;
}
List<XmlFile> targets = LayoutIndex.getLayoutFiles(position.getProject());
if (targets.size() > 0) {
for (XmlFile file : targets) {
result.addElement(
LookupElementBuilder
.create(file.getVirtualFile().getNameWithoutExtension())
.withIcon(PhpIcons.XML_TAG_ICON)
);
}
}
}
示例14: addCompletions
import com.intellij.codeInsight.completion.CompletionResultSet; //導入依賴的package包/類
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
ProcessingContext context,
@NotNull CompletionResultSet result) {
PsiElement position = parameters.getPosition().getOriginalElement();
if (position == null) {
return;
}
PhpClass phpClass = DiIndex.getPhpClassOfServiceMethod((XmlElement) position);
if (phpClass != null) {
for (Method method : phpClass.getMethods()) {
result.addElement(
LookupElementBuilder
.create(method.getName())
.withIcon(method.getIcon())
);
}
}
}
示例15: extendWithParameterTypes
import com.intellij.codeInsight.completion.CompletionResultSet; //導入依賴的package包/類
/**
* Complete types in {@param ...} .
*/
private void extendWithParameterTypes() {
// Complete types in @param.
extend(
CompletionType.BASIC,
psiElement()
.andOr(
psiElement().inside(SoyAtParamSingle.class).afterLeaf(":"),
psiElement().inside(SoyAtInjectSingle.class).afterLeaf(":"),
// List type literal.
psiElement().inside(SoyListType.class).afterLeaf("<"),
// Map type literal.
psiElement().inside(SoyMapType.class).afterLeaf("<"),
psiElement().inside(SoyMapType.class).afterLeaf(",")),
new CompletionProvider<CompletionParameters>() {
@Override
protected void addCompletions(
@NotNull CompletionParameters completionParameters,
ProcessingContext processingContext,
@NotNull CompletionResultSet completionResultSet) {
completionResultSet.addAllElements(soyTypeLiterals);
}
});
}