Search in sources :

Example 16 with BLangType

use of org.wso2.ballerinalang.compiler.tree.types.BLangType in project ballerina by ballerina-lang.

the class BLangPackageBuilder method markTypeNodeAsGrouped.

public void markTypeNodeAsGrouped(Set<Whitespace> ws) {
    BLangType typeNode = (BLangType) this.typeNodeStack.peek();
    typeNode.addWS(ws);
    typeNode.grouped = true;
}
Also used : BLangType(org.wso2.ballerinalang.compiler.tree.types.BLangType)

Example 17 with BLangType

use of org.wso2.ballerinalang.compiler.tree.types.BLangType in project ballerina by ballerina-lang.

the class ConnectorContextItemSorter method sortItems.

@Override
public void sortItems(TextDocumentServiceContext ctx, List<CompletionItem> completionItems) {
    BLangNode previousNode = ctx.get(CompletionKeys.PREVIOUS_NODE_KEY);
    /*
        Remove the statement type completion type. When the going through the parser
        rule contexts such as typeNameContext, we add the statements as well.
        Sorters are responsible for to the next level of such filtering.
         */
    this.removeCompletionsByType(new ArrayList<>(Collections.singletonList(ItemResolverConstants.STATEMENT_TYPE)), completionItems);
    if (previousNode == null) {
        this.populateWhenCursorBeforeOrAfterEp(completionItems);
    } else if (previousNode instanceof BLangVariableDef) {
        // BType bLangType = ((BLangVariableDef) previousNode).var.type;
        // if (bLangType instanceof BEndpointType) {
        // this.populateWhenCursorBeforeOrAfterEp(completionItems);
        // } else {
        this.setPriorities(completionItems);
        CompletionItem resItem = this.getActionSnippet();
        resItem.setSortText(Priority.PRIORITY160.toString());
        completionItems.add(resItem);
    // }
    } else if (previousNode instanceof BLangAction) {
        completionItems.clear();
        completionItems.add(this.getActionSnippet());
    }
}
Also used : BLangNode(org.wso2.ballerinalang.compiler.tree.BLangNode) CompletionItem(org.eclipse.lsp4j.CompletionItem) BLangVariableDef(org.wso2.ballerinalang.compiler.tree.statements.BLangVariableDef) BLangAction(org.wso2.ballerinalang.compiler.tree.BLangAction)

Aggregations

BLangType (org.wso2.ballerinalang.compiler.tree.types.BLangType)5 BType (org.wso2.ballerinalang.compiler.semantics.model.types.BType)3 CompletionItem (org.eclipse.lsp4j.CompletionItem)2 BLangNode (org.wso2.ballerinalang.compiler.tree.BLangNode)2 BLangVariableDef (org.wso2.ballerinalang.compiler.tree.statements.BLangVariableDef)2 ArrayList (java.util.ArrayList)1 EnumSet (java.util.EnumSet)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Parameter (org.ballerinalang.composer.service.ballerina.parser.service.model.lang.Parameter)1 Whitespace (org.ballerinalang.model.Whitespace)1 DiagnosticCode (org.ballerinalang.util.diagnostic.DiagnosticCode)1 SymbolEnv (org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv)1 BSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BSymbol)1 BConnectorType (org.wso2.ballerinalang.compiler.semantics.model.types.BConnectorType)1 BInvokableType (org.wso2.ballerinalang.compiler.semantics.model.types.BInvokableType)1 BUnionType (org.wso2.ballerinalang.compiler.semantics.model.types.BUnionType)1 BLangAction (org.wso2.ballerinalang.compiler.tree.BLangAction)1 BLangAnnotation (org.wso2.ballerinalang.compiler.tree.BLangAnnotation)1 BLangAnnotationAttachmentPoint (org.wso2.ballerinalang.compiler.tree.BLangAnnotationAttachmentPoint)1