@Override public List<CompletionItem> resolveItems(LSServiceOperationContext completionContext) { ArrayList<CompletionItem> completionItems = new ArrayList<>(); BLangNode bLangNode = completionContext.get(CompletionKeys.SYMBOL_ENV_NODE_KEY); BType recordType = bLangNode.type; if (!recordType.getKind().equals(TypeKind.RECORD)) { return completionItems; } List<BField> fields = this.getFieldList((BLangRecordLiteral) bLangNode, completionContext); completionItems.addAll(CommonUtil.getStructFieldCompletionItems(fields)); completionItems.add(CommonUtil.getFillAllStructFieldsItem(fields)); return completionItems; }
private static BType getMessageParamType(List<?> variableNodes) throws GrpcServerException { BType requestType = null; for (Object variable : variableNodes) { if (variable instanceof BLangNode) { BType tempType = ((BLangNode) variable).type; if (tempType.getKind().equals(TypeKind.ARRAY)) { requestType = tempType; break; } // union type and tuple type doesn't have type symbol. If those values pass as response, compiler // failed to derive response message type. Validate and send proper error message. if (tempType.tsymbol == null) { throw new GrpcServerException("Invalid message type. Message type doesn't have type symbol"); } if ("ballerina/grpc:Caller".equals(tempType.tsymbol.toString()) || "ballerina/grpc:Headers" .equals(tempType.tsymbol.toString())) { continue; } requestType = tempType; break; } else { throw new GrpcServerException("Request Message type is not supported, should be lang variable."); } } if (requestType == null) { requestType = new BNilType(); } return requestType; }
public void visit(BLangTypeDefinition typeDefinition) { if (typeDefinition.typeNode.getKind() == NodeKind.OBJECT_TYPE || typeDefinition.typeNode.getKind() == NodeKind.RECORD_TYPE) { analyzeNode(typeDefinition.typeNode, this.env); } if (!Symbols.isPublic(typeDefinition.symbol) || typeDefinition.symbol.type != null && TypeKind.FINITE.equals(typeDefinition.symbol.type.getKind())) { return; } analyseType(typeDefinition.symbol.type, typeDefinition.pos); }
if (fileEvent.getKind().equals(TypeKind.OBJECT)) { if (fileEvent instanceof BStructureType) { BStructureType event = (BStructureType) fileEvent;