Search in sources :

Example 6 with BAnnotationSymbol

use of org.wso2.ballerinalang.compiler.semantics.model.symbols.BAnnotationSymbol in project ballerina by ballerina-lang.

the class AbstractItemResolver method populateCompletionItemList.

/**
 * Populate the completion item list by considering the.
 * @param symbolInfoList - list of symbol information
 * @param completionItems - completion item list to populate
 */
protected void populateCompletionItemList(List<SymbolInfo> symbolInfoList, List<CompletionItem> completionItems) {
    symbolInfoList.forEach(symbolInfo -> {
        CompletionItem completionItem = null;
        BSymbol bSymbol = symbolInfo.getScopeEntry() != null ? symbolInfo.getScopeEntry().symbol : null;
        if ((bSymbol instanceof BInvokableSymbol && ((BInvokableSymbol) bSymbol).kind != null && !((BInvokableSymbol) bSymbol).kind.equals(SymbolKind.WORKER)) || symbolInfo.isIterableOperation()) {
            completionItem = this.populateBallerinaFunctionCompletionItem(symbolInfo);
        } else if (!(bSymbol instanceof BInvokableSymbol) && bSymbol instanceof BVarSymbol) {
            completionItem = this.populateVariableDefCompletionItem(symbolInfo);
        } else if (bSymbol instanceof BTypeSymbol && !bSymbol.getName().getValue().equals(UtilSymbolKeys.NOT_FOUND_TYPE) && !(bSymbol instanceof BAnnotationSymbol)) {
            completionItem = this.populateBTypeCompletionItem(symbolInfo);
        }
        if (completionItem != null) {
            completionItems.add(completionItem);
        }
    });
}
Also used : BSymbol(org.wso2.ballerinalang.compiler.semantics.model.symbols.BSymbol) CompletionItem(org.eclipse.lsp4j.CompletionItem) BInvokableSymbol(org.wso2.ballerinalang.compiler.semantics.model.symbols.BInvokableSymbol) BTypeSymbol(org.wso2.ballerinalang.compiler.semantics.model.symbols.BTypeSymbol) BVarSymbol(org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol) BAnnotationSymbol(org.wso2.ballerinalang.compiler.semantics.model.symbols.BAnnotationSymbol)

Aggregations

BAnnotationSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BAnnotationSymbol)5 SymbolEnv (org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv)3 ArrayList (java.util.ArrayList)2 BAnnotationAttributeSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BAnnotationAttributeSymbol)2 BInvokableSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BInvokableSymbol)2 BSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BSymbol)2 BLangAnnotation (org.wso2.ballerinalang.compiler.tree.BLangAnnotation)2 BLangPackage (org.wso2.ballerinalang.compiler.tree.BLangPackage)2 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 EnumSet (java.util.EnumSet)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Optional (java.util.Optional)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 CompilerPhase (org.ballerinalang.compiler.CompilerPhase)1 CompilerPlugin (org.ballerinalang.compiler.plugins.CompilerPlugin)1 SupportedAnnotationPackages (org.ballerinalang.compiler.plugins.SupportedAnnotationPackages)1 TreeBuilder (org.ballerinalang.model.TreeBuilder)1