Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5e2121b
Extend function search for workspace
dulajdilshan Feb 5, 2026
c2db8b2
Add isPublic flag for functions
dulajdilshan Feb 5, 2026
721f702
Merge remote-tracking branch 'upstream/main' into ls-api-workspace
dulajdilshan Feb 11, 2026
fc0b988
Change the order of the workspace function search
dulajdilshan Feb 12, 2026
7c7f129
Implement types search for workspace-level public types
dulajdilshan Feb 12, 2026
b545236
Fix type search tests
dulajdilshan Feb 12, 2026
82c7096
Fix function search tests
dulajdilshan Feb 12, 2026
bde4cbc
Add `public` qualifier support for types
dulajdilshan Feb 12, 2026
e4b0c9f
Fix and add tests
dulajdilshan Feb 12, 2026
61cc617
Fix tests for `isPublic` property
dulajdilshan Feb 12, 2026
fe5e1f9
Fix casing for error value in currency_converter1.json
dulajdilshan Feb 12, 2026
cadd757
Add tests for workspace-level function search
dulajdilshan Feb 16, 2026
eb0f5f1
Update type and function search with "(current)" indicator
dulajdilshan Feb 16, 2026
81e2b2b
Fix tests
dulajdilshan Feb 17, 2026
1c33a32
Add search test for workspace-level types
dulajdilshan Feb 17, 2026
2acf91c
Merge remote-tracking branch 'upstream/main' into ls-api-workspace
dulajdilshan Feb 17, 2026
a7edd2f
Refactor type search logic to use pattern matching and enhance enum g…
dulajdilshan Feb 17, 2026
4727700
Merge remote-tracking branch 'upstream/main' into ls-api-workspace
dulajdilshan Feb 17, 2026
2e65a45
Change keywords of current workspace and integration and update tests
dulajdilshan Feb 17, 2026
71ebd56
Add isLibrary attribute and checker for library projects
dulajdilshan Feb 17, 2026
49e34e7
Revert "Fix casing for error value in currency_converter1.json"
dulajdilshan Feb 17, 2026
fb57607
Change isPublic property description
dulajdilshan Feb 17, 2026
389468a
Add function source code generation tests
dulajdilshan Feb 17, 2026
47c1189
Implement isPublic for data-mapper
dulajdilshan Feb 17, 2026
a6d8cd8
Fix tests
dulajdilshan Feb 17, 2026
76deb63
Update data-mapper test
dulajdilshan Feb 17, 2026
e08a0a3
Merge branch 'main' into ls-api-workspace
dulajdilshan Feb 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@

package io.ballerina.designmodelgenerator.extension;

import io.ballerina.compiler.syntax.tree.ImportDeclarationNode;
import io.ballerina.compiler.syntax.tree.ModulePartNode;
import io.ballerina.compiler.syntax.tree.SyntaxTree;
import io.ballerina.compiler.syntax.tree.Token;
import io.ballerina.designmodelgenerator.extension.response.ProjectInfoResponse;
import io.ballerina.projects.BallerinaToml;
import io.ballerina.projects.Document;
import io.ballerina.projects.DocumentId;
import io.ballerina.projects.Module;
import io.ballerina.projects.Package;
import io.ballerina.projects.Project;
import io.ballerina.projects.ProjectKind;
Expand Down Expand Up @@ -105,6 +112,7 @@ public void populate() {
// Set org and version for build projects
response.setOrg(currentPackage.packageOrg().value());
response.setVersion(currentPackage.packageVersion().value().toString());
response.setIsLibrary(isLibraryProject(project));
}
}

Expand Down Expand Up @@ -141,6 +149,42 @@ private List<ProjectInfoResponse> extractChildProjects() {
return children;
}

private static final String LIB_BAL = "lib.bal";
private static final String BI_VALIDATOR_ORG = "wso2";
private static final String BI_VALIDATOR_MODULE = "bi.validator";

/**
* Checks if the given project is a library project by looking for a lib.bal file containing the
* {@code import wso2/bi.validator as _;} import declaration.
*
* @param project The project to check
* @return true if the project is a library project
*/
private static boolean isLibraryProject(Project project) {
Module defaultModule = project.currentPackage().getDefaultModule();
for (DocumentId documentId : defaultModule.documentIds()) {
Document document = defaultModule.document(documentId);
if (!LIB_BAL.equals(document.name())) {
continue;
}
SyntaxTree syntaxTree = document.syntaxTree();
ModulePartNode modulePartNode = syntaxTree.rootNode();
for (ImportDeclarationNode importDecl : modulePartNode.imports()) {
if (importDecl.orgName().isEmpty()) {
continue;
}
String orgName = importDecl.orgName().get().orgName().text();
String moduleName = importDecl.moduleName().stream()
.map(Token::text)
.collect(Collectors.joining("."));
if (BI_VALIDATOR_ORG.equals(orgName) && BI_VALIDATOR_MODULE.equals(moduleName)) {
return true;
}
}
}
return false;
}

/**
* Formats a package/project name to title case for display purposes. Converts snake_case and camelCase to Title
* Case.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class ProjectInfoResponse extends AbstractResponse {
private String org; // Package organization
private String version; // Package version
private List<ProjectInfoResponse> children; // Only populated for workspace projects (recursive)
private Boolean isLibrary; // Whether the project is a library project

public String getProjectKind() {
return projectKind;
Expand Down Expand Up @@ -90,4 +91,12 @@ public List<ProjectInfoResponse> getChildren() {
public void setChildren(List<ProjectInfoResponse> children) {
this.children = children;
}

public Boolean getIsLibrary() {
return isLibrary;
}

public void setIsLibrary(Boolean isLibrary) {
this.isLibrary = isLibrary;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"title": "Simple Service",
"projectPath": "proj",
"org": "test",
"version": "0.1.0"
"version": "0.1.0",
"isLibrary": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,26 @@
"title": "Common",
"projectPath": "workspace_proj/common",
"org": "wso2",
"version": "0.1.0"
"version": "0.1.0",
"isLibrary": true
},
{
"projectKind": "BUILD_PROJECT",
"name": "api_gateway",
"title": "API Gateway",
"projectPath": "workspace_proj/api-gateway",
"org": "wso2",
"version": "0.1.0"
"version": "0.1.0",
"isLibrary": false
},
{
"projectKind": "BUILD_PROJECT",
"name": "user_service",
"title": "User Service",
"projectPath": "workspace_proj/user-service",
"org": "wso2",
"version": "0.1.0"
"version": "0.1.0",
"isLibrary": false
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import wso2/bi.validator as _;
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ public enum Name {
CONCURRENCY("Concurrency", "Concurrency nodes", null),
ERROR_HANDLING("Error Handling", "Handle errors that occur during execution", null),
DATA("Data", "Data nodes are used to create, read, update, delete, and transform data", null),
CURRENT_INTEGRATION("Current Integration", "Functions defined within the current integration",
List.of("Project", "Local", "Function")),
CURRENT_INTEGRATION("Current Integration", "Components defined within the current integration",
List.of("Project", "Local", "Function", "Types", "Data Mapper")),
CURRENT_WORKSPACE("Current Workspace", "Components available in the current workspace",
List.of("Workspace", "Local", "Function", "Types", "Data Mapper")),
AGENT_TOOLS("Agent Tools", "Functions used as agent tools", List.of("Project", "Local", "Function")),
CURRENT_ORGANIZATION("Current Organization", "Components in the current organization",
List.of("Organization", "Function", "Library")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ public FormBuilder<T> isPublic(boolean value, boolean optional, boolean editable
.editable(editable)
.optional(optional)
.advanced(advanced)
.value(String.valueOf(value))
.value(value)
.type()
.fieldType(Property.ValueType.FLAG)
.selected(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public static void setMandatoryProperties(NodeBuilder nodeBuilder, String return
.functionDescription(description)
.returnType(returnType, null, true)
.returnDescription(returnDescription)
.isPublic(false, false, true, false)
.nestedProperty();
}

Expand Down Expand Up @@ -164,6 +165,12 @@ public Map<Path, List<TextEdit>> toSource(SourceBuilder sourceBuilder) {
if (annotationsProperty.isPresent()) {
sourceBuilder.token().name(annotationsProperty.get().toSourceCode());
}

Optional<Property> visibilityProperty = sourceBuilder.getProperty(Property.IS_PUBLIC_KEY);
if (visibilityProperty.isPresent() && Boolean.parseBoolean(visibilityProperty.get().value().toString())) {
sourceBuilder.token().keyword(SyntaxKind.PUBLIC_KEYWORD);
}

Optional<Property> isolatedProperty = sourceBuilder.getProperty(Property.IS_ISOLATED_KEY);
if (isolatedProperty.isPresent()) {
sourceBuilder.token().keyword(SyntaxKind.ISOLATED_KEYWORD);
Expand Down
Loading
Loading