use of com.perl5.lang.perl.psi.references.PerlBuiltInVariablesService in project Perl5-IDEA by Camelcade.
the class PerlVariableCompletionUtil method fillWithBuiltInVariables.
public static void fillWithBuiltInVariables(@NotNull PsiElement variableNameElement, @NotNull CompletionResultSet resultSet) {
PsiElement perlVariable = variableNameElement.getParent();
PerlBuiltInVariablesService perlBuiltInVariablesService = PerlBuiltInVariablesService.getInstance(variableNameElement.getProject());
if (perlVariable instanceof PsiPerlScalarVariable) {
perlBuiltInVariablesService.processScalars((element, state) -> {
// noinspection ConstantConditions
resultSet.addElement(getScalarLookupElement(((PerlVariableDeclarationElement) element).getName()).withBoldness(true));
return true;
});
perlBuiltInVariablesService.processArrays((element, state) -> {
// noinspection ConstantConditions
resultSet.addElement(getArrayElementLookupElement(((PerlVariableDeclarationElement) element).getName()).withBoldness(true));
return true;
});
perlBuiltInVariablesService.processHashes((element, state) -> {
// noinspection ConstantConditions
resultSet.addElement(getHashElementLookupElement(((PerlVariableDeclarationElement) element).getName()).withBoldness(true));
return true;
});
} else if (perlVariable instanceof PsiPerlArrayVariable) {
perlBuiltInVariablesService.processArrays((element, state) -> {
// noinspection ConstantConditions
resultSet.addElement(getArrayLookupElement(((PerlVariableDeclarationElement) element).getName()).withBoldness(true));
// noinspection ConstantConditions
resultSet.addElement(getArraySliceLookupElement(((PerlVariableDeclarationElement) element).getName()).withBoldness(true));
return true;
});
perlBuiltInVariablesService.processHashes((element, state) -> {
// noinspection ConstantConditions
resultSet.addElement(getHashSliceLookupElement(((PerlVariableDeclarationElement) element).getName()).withBoldness(true));
return true;
});
} else if (perlVariable instanceof PsiPerlArrayIndexVariable) {
perlBuiltInVariablesService.processArrays((element, state) -> {
// noinspection ConstantConditions
resultSet.addElement(getArrayLookupElement(((PerlVariableDeclarationElement) element).getName()).withBoldness(true));
return true;
});
} else if (perlVariable instanceof PsiPerlHashVariable) {
perlBuiltInVariablesService.processHashes((element, state) -> {
// noinspection ConstantConditions
resultSet.addElement(getHashLookupElement(((PerlVariableDeclarationElement) element).getName()).withBoldness(true));
return true;
});
} else if (perlVariable instanceof PsiPerlGlobVariable) {
perlBuiltInVariablesService.processGlobs((element, state) -> {
// noinspection ConstantConditions
resultSet.addElement(getGlobLookupElement(((PerlVariableDeclarationElement) element).getName()).withBoldness(true));
return true;
});
}
}
Aggregations