Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
21289f6
Add 'create as workspace' option in creation form
madushajg Oct 9, 2025
b0a10f6
Fix handling of local connectors in project artifacts by ensuring a d…
madushajg Oct 10, 2025
1155307
Enable rendering package overview when opening ballerina workspace
madushajg Oct 10, 2025
967d180
Fix rendering BI project-explorer for BI workspaces
madushajg Oct 14, 2025
4b4f419
Add wide-chevron SVG icon to common libraries
madushajg Oct 14, 2025
f4198cb
Enhance state machine and top navigation bar to include package infor…
madushajg Oct 14, 2025
217d827
Add rpc fn to check for ballerina workspaces
madushajg Oct 14, 2025
e78d60d
Display package names in top nav bar only for worskapces
madushajg Oct 14, 2025
7cd834c
Refactor TopNavigationBar to enhance package name display with icon a…
madushajg Oct 15, 2025
b7c8f38
Add 'Add Project' functionality with form and validation in BI visual…
madushajg Oct 16, 2025
17b09cb
Refactor project URI references to project path in ballerina extensio…
madushajg Oct 17, 2025
1ec97e9
Refactor documentation and test generation functions to use project p…
madushajg Oct 17, 2025
16ff741
Enable adding new projects for existing workspaces
madushajg Oct 20, 2025
3b821ad
Enable converting exsisting projects into workspaces
madushajg Oct 20, 2025
ce6ca9e
Enable switch between workspace packages
madushajg Oct 21, 2025
6d6b59d
Add missing import
madushajg Oct 21, 2025
6ebb4f2
Merge pull request #696 from madushajg/bi-multi-projects
madushajg Oct 21, 2025
d26e07f
Merge remote-tracking branch 'upstream/main' into bi-multi-projects-ext
madushajg Oct 21, 2025
ac1ea14
Merge pull request #697 from madushajg/bi-multi-projects-ext
madushajg Oct 21, 2025
4e3c335
Update package filtering logic to ensure only valid Ballerina package…
madushajg Oct 21, 2025
32e217b
Refactor project path handling in AI panel RPC manager and state mach…
madushajg Oct 22, 2025
e9d7a38
Fix fast-run to work with workspace projects
NipunaRanasinghe Oct 22, 2025
5634d82
Refactor Ballerina workspace handling to use async functions for chec…
madushajg Oct 23, 2025
0c6bca5
Merge remote-tracking branch 'upstream/main' into bi-multi-projects-ext
madushajg Oct 23, 2025
2f15ea3
Refactor project URI handling to use projectPath instead of projectUri
madushajg Oct 23, 2025
6289f01
Merge pull request #726 from madushajg/bi-multi-projects-ext
madushajg Oct 23, 2025
91e1195
Fix error messages shown when stepping into other packages within the…
NipunaRanasinghe Oct 27, 2025
a9ca370
Fix project selection and debug restart flows in BI mode
NipunaRanasinghe Oct 28, 2025
be7b4f5
Apply suggestions from code review
NipunaRanasinghe Oct 28, 2025
98ed313
Address more review suggestions
NipunaRanasinghe Oct 28, 2025
397d23e
Merge remote-tracking branch 'upstream/main' into bi-multi-projects-ext
madushajg Oct 29, 2025
a547b20
Merge pull request #761 from NipunaRanasinghe/bi-multi-project
NipunaRanasinghe Oct 29, 2025
ff10e49
Merge pull request #767 from madushajg/bi-multi-projects-ext
madushajg Oct 30, 2025
766afdb
Refactor filterPackagePaths to use Promise.all for improved async han…
madushajg Oct 31, 2025
4a639b2
Merge pull request #785 from madushajg/bi-multi-project
madushajg Oct 31, 2025
f3aeda9
Merge remote-tracking branch 'upstream/main' into bi-multi-project-sync
madushajg Oct 31, 2025
08a55a0
Merge pull request #786 from madushajg/bi-multi-project-sync
madushajg Oct 31, 2025
2969ada
Remove redundant commands
gigara Nov 4, 2025
1ef5762
Fix test results cache key id
gigara Nov 4, 2025
268d848
Remove console log for redirect location in downloadFile function
gigara Nov 4, 2025
fc07eea
Merge branch 'main' into pipeline-fix
gigara Nov 4, 2025
73f73fa
Merge branch 'main' into pipeline-fix
gigara Nov 4, 2025
42d528e
Merge branch 'main' into pipeline-fix
gigara Nov 4, 2025
9c074bb
Merge remote-tracking branch 'upstream/main' into bi-multi-project-sync
madushajg Nov 5, 2025
617b125
Merge pull request #835 from madushajg/bi-multi-project-sync
madushajg Nov 6, 2025
d6b2588
Increase wait time for pom.xml update during project version change
tharindulak Nov 6, 2025
3eae13d
Merge branch 'main' of https://github.com/wso2/vscode-extensions into…
tharindulak Nov 6, 2025
b6b6a44
Merge branch 'main' into pipeline-fix
gigara Nov 6, 2025
9b52dd5
Merge branch 'main' into pipeline-fix
gigara Nov 6, 2025
ff3d2a6
Merge branch 'main' into pipeline-fix
gigara Nov 6, 2025
a101780
Implement new login flow
IsuruMaduranga Oct 14, 2025
15eab03
Implement suggestion genaration
IsuruMaduranga Oct 25, 2025
4ebab82
Implement code generation
IsuruMaduranga Oct 26, 2025
a86c70b
Implement connector selection
IsuruMaduranga Oct 26, 2025
4fba3f2
Implement code diagnostics
IsuruMaduranga Oct 26, 2025
30db7dd
Implement data mapper
IsuruMaduranga Oct 26, 2025
99aa23c
Fix copilot chat header
IsuruMaduranga Oct 26, 2025
0c7a5d1
Implement new auth process
IsuruMaduranga Oct 26, 2025
f0acdf0
Improve auth process
IsuruMaduranga Oct 26, 2025
f825c48
Remove setAnthropicKey rpc
IsuruMaduranga Oct 27, 2025
b4a9627
Fix ai proxy integration
IsuruMaduranga Oct 27, 2025
7983044
Implement usage quota
IsuruMaduranga Oct 27, 2025
97bf654
Improve usage quota handling
IsuruMaduranga Oct 27, 2025
fefb3e3
Fix bug in suggestion generation
IsuruMaduranga Oct 28, 2025
501a084
Implement test generation
IsuruMaduranga Oct 28, 2025
1c95a83
Implement IDP
IsuruMaduranga Oct 28, 2025
e5e0268
Implement efficient suggesions
IsuruMaduranga Oct 28, 2025
3e2cc3b
Implement DMC to TS
IsuruMaduranga Oct 29, 2025
efffc5f
Implement auto fill
IsuruMaduranga Oct 30, 2025
fff7e2f
Implement fill IDP schema
IsuruMaduranga Oct 30, 2025
f5045c9
Cleanup dead code
IsuruMaduranga Oct 30, 2025
51ee052
Add AI module guide
IsuruMaduranga Oct 30, 2025
097cc5e
Improve prompts for older MI versions
IsuruMaduranga Oct 30, 2025
ead8abd
Add code generation for older MI versions
IsuruMaduranga Nov 4, 2025
8967a0e
Remove unused code
IsuruMaduranga Nov 4, 2025
5a32609
Improve logging
IsuruMaduranga Nov 4, 2025
12c254a
Implement proper prompt caching
IsuruMaduranga Nov 4, 2025
76e20c0
Improve prompts
IsuruMaduranga Nov 4, 2025
4d5c93d
Fix PR comments
IsuruMaduranga Nov 4, 2025
8900364
Fix code generation abort
IsuruMaduranga Nov 4, 2025
fb82d1a
Fix coderabbit PR comments
IsuruMaduranga Nov 6, 2025
1f3269a
Fix code rabbit PR commits
IsuruMaduranga Nov 6, 2025
03f0c11
Clear console logs from ai panel RPC manager
IsuruMaduranga Nov 6, 2025
019c9cf
Fix image, pdf and file support
IsuruMaduranga Nov 6, 2025
054f3cc
Improve file upload
IsuruMaduranga Nov 6, 2025
0f8db56
Improve error logging
IsuruMaduranga Nov 6, 2025
dab9088
Improve error handling in code generation
IsuruMaduranga Nov 6, 2025
78dfe81
Fix code rabbit PR commits
IsuruMaduranga Nov 6, 2025
da4ee8b
Handle undefined api key error
IsuruMaduranga Nov 6, 2025
3e37f5d
Fix an issue in diagnostics prompt
IsuruMaduranga Nov 6, 2025
938713c
Increase wait times for dependency loading and pom.xml updates
tharindulak Nov 6, 2025
856cb6e
Merge branch 'main' into pipeline-fix
gigara Nov 6, 2025
ff3aa4e
Merge pull request #853 from wso2/sync/main-release-ballerina-1762449207
kanushka Nov 6, 2025
b79de0f
Merge branch 'main' of https://github.com/wso2/vscode-extensions into…
tharindulak Nov 7, 2025
ce7a32e
Merge branch 'main' into pipeline-fix
gigara Nov 7, 2025
de5b426
Merge branch 'main' into copilot
gigara Nov 7, 2025
8ab9a18
Merge pull request #858 from tharindulak/fix-intermittent
tharindulak Nov 7, 2025
0016864
Update pnpm-lock
IsuruMaduranga Nov 7, 2025
f4342fc
fix create connection new variable pop form not saving
senithkay Nov 7, 2025
29ec72d
Merge branch 'main' into pipeline-fix
gigara Nov 7, 2025
f0e908b
Enhance Ballerina project handling and debugging features
madushajg Nov 7, 2025
0d8e1b4
Merge branch 'main' into copilot
gigara Nov 7, 2025
2fbdfc2
Merge pull request #861 from madushajg/bi-multi-project-sync
madushajg Nov 7, 2025
46ce309
Merge pull request #771 from IsuruMaduranga/copilot
IsuruMaduranga Nov 7, 2025
1e8d2fa
Fix package vulverability
tharindulak Nov 8, 2025
8cb4608
Merge pull request #864 from tharindulak/fix-intermittent
tharindulak Nov 8, 2025
96d723a
Merge branch 'main' into pipeline-fix
tharindulak Nov 8, 2025
3ad515f
Merge pull request #814 from gigara/pipeline-fix
gigara Nov 8, 2025
87b077d
fix PR issues
senithkay Nov 10, 2025
4861873
Merge branch 'main' of https://github.com/wso2/vscode-extensions into…
senithkay Nov 10, 2025
3a282fd
Merge remote-tracking branch 'upstream/main' into bi-multi-project
madushajg Nov 7, 2025
8c156cb
Merge remote-tracking branch 'upstream/main' into bi-multi-project
madushajg Nov 10, 2025
4a84e8c
Merge branch 'bi-multi-project' into bi-multi-project
madushajg Nov 10, 2025
69afcb1
Update webview content to conditionally display loading title based o…
madushajg Nov 10, 2025
4b57936
Refactor project checking logic in state machine to support switching…
madushajg Nov 10, 2025
1e66390
Ignore exact name check in saving the form
sachiniSam Nov 10, 2025
4ab43fe
Refactor project root retrieval logic to improve consistency and remo…
madushajg Nov 10, 2025
e5d8168
Merge remote-tracking branch 'origin/bi-multi-project' into bi-multi-…
madushajg Nov 10, 2025
1013b27
Update Ballerina workspace documentation link in state machine
madushajg Nov 10, 2025
1a8b261
Merge pull request #866 from madushajg/bi-multi-project-path
madushajg Nov 10, 2025
3d22f1f
Update chat agent creation to generate agent at module level for U12
dan-niles Nov 10, 2025
ceefcd8
Improve legacy version check for AIChatAgentWizard to handle version …
dan-niles Nov 10, 2025
7c2f887
Add error handling for Ballerina version retrieval in AIChatAgentWizard
dan-niles Nov 10, 2025
8a361be
Address review suggestions
madushajg Nov 10, 2025
6868dbf
Merge pull request #869 from dan-niles/fix-agent-creation-for-u12
madushajg Nov 10, 2025
4423887
Merge branch 'main' into bi-multi-project
madushajg Nov 10, 2025
fb946d9
Merge remote-tracking branch 'upstream/bi-multi-project' into bi-mult…
madushajg Nov 10, 2025
fbb9496
Merge pull request #868 from wso2/bi-multi-project
kanushka Nov 10, 2025
a06efd7
Address review suggestions
madushajg Nov 10, 2025
a51d2df
Merge branch 'main' into bi-multi-project
kanushka Nov 10, 2025
db06bed
Merge pull request #872 from madushajg/bi-multi-project
madushajg Nov 10, 2025
97eab5d
Merge branch 'main' into FixImport
madushajg Nov 10, 2025
a12771e
Enhance ExpressionField and ChipExpressionBaseComponent to support on…
kanushka Nov 10, 2025
9ce2097
Merge branch 'main' into task-2
kanushka Nov 10, 2025
c157960
Merge pull request #865 from sachiniSam/FixImport
kanushka Nov 10, 2025
d0c3b16
Merge branch 'main' into task-2
kanushka Nov 10, 2025
e1e7e89
Merge pull request #873 from kanushka/task-2
kanushka Nov 10, 2025
378aa6b
Merge branch 'main' into fix-create-connection-new-var-form
kanushka Nov 10, 2025
66d595a
Merge pull request #859 from senithkay/fix-create-connection-new-var-…
kanushka Nov 10, 2025
85754c4
Refactor project root retrieval in test generation and documentation …
madushajg Nov 10, 2025
307c614
Update project command title in package.json and enhance package sele…
madushajg Nov 10, 2025
d226d81
Merge remote-tracking branch 'upstream/main' into bi-multi-project
madushajg Nov 10, 2025
5289af9
Merge pull request #874 from madushajg/bi-multi-project
madushajg Nov 10, 2025
ab1b220
Update changelog for Ballerina and BI extensions to reflect the addit…
madushajg Nov 10, 2025
396d45e
Merge branch 'main' into changelog
madushajg Nov 10, 2025
b53a11f
Merge pull request #875 from madushajg/changelog
madushajg Nov 10, 2025
db64a27
Update version to ballerina-integrator-1.5.0
choreo-cicd Nov 10, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ jobs:
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: ${{ matrix.name }}-e2e-test-results-${{ matrix.group }}-${{ env.PREVIOUS_ATTEMPT }}
name: ${{ matrix.name }}-e2e-test-results-${{ matrix.os }}-${{ matrix.group }}-${{ env.PREVIOUS_ATTEMPT }}
path: workspaces/${{ matrix.path }}/test-results

- name: install packages
Expand Down Expand Up @@ -413,7 +413,7 @@ jobs:
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.name }}I-e2e-test-results-${{ matrix.os }}-${{ matrix.group }}-${{ github.run_attempt }}
name: ${{ matrix.name }}-e2e-test-results-${{ matrix.os }}-${{ matrix.group }}-${{ github.run_attempt }}
path: workspaces/${{ matrix.path }}/test-results/**
retention-days: 5
include-hidden-files: true
Expand Down
6 changes: 6 additions & 0 deletions common/config/rush/.pnpmfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ module.exports = {
if (pkg.dependencies['form-data']) {
pkg.dependencies['form-data'] = '^4.0.4';
}
if (pkg.dependencies['min-document']) {
pkg.dependencies['min-document'] = '^2.19.1';
}
}

if (pkg.devDependencies) {
Expand Down Expand Up @@ -97,6 +100,9 @@ module.exports = {
if (pkg.devDependencies['form-data']) {
pkg.devDependencies['form-data'] = '^4.0.4';
}
if (pkg.devDependencies['min-document']) {
pkg.devDependencies['min-document'] = '^2.19.1';
}
}

return pkg;
Expand Down
1,998 changes: 1,073 additions & 925 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,7 @@
* The list of shell commands to run before the Rush build command starts
*/
"preRushBuild": [
"npm run init-submodules",
"cd workspaces/mi/mi-extension && pnpm run download-ls",
"cd workspaces/ballerina/ballerina-extension && pnpm run download-ls"
"npm run init-submodules"
],
/**
* The list of shell commands to run after the Rush build command finishes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ export interface ExecutorPositions {
// Test Manager related interfaces

export interface TestsDiscoveryRequest {
filePath: string;
projectPath: string;
}

export interface TestsDiscoveryResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ import {
RecordsInWorkspaceMentions,
BuildMode,
DevantMetadata,
GeneratedClientSaveResponse
GeneratedClientSaveResponse,
AddProjectToWorkspaceRequest
} from "./interfaces";

export interface BIDiagramAPI {
Expand All @@ -137,6 +138,7 @@ export interface BIDiagramAPI {
getNodeTemplate: (params: BINodeTemplateRequest) => Promise<BINodeTemplateResponse>;
getAiSuggestions: (params: BIAiSuggestionsRequest) => Promise<BIAiSuggestionsResponse>;
createProject: (params: ProjectRequest) => void;
addProjectToWorkspace: (params: AddProjectToWorkspaceRequest) => void;
getWorkspaces: () => Promise<WorkspacesResponse>;
getProjectStructure: () => Promise<ProjectStructureResponse>;
getProjectComponents: () => Promise<ProjectComponentsResponse>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ export interface ProjectRequest {
packageName: string;
projectPath: string;
createDirectory: boolean;
createAsWorkspace?: boolean;
workspaceName?: string;
orgName?: string;
version?: string;
}

export interface AddProjectToWorkspaceRequest {
projectName: string;
packageName: string;
path: string;
convertToWorkspace?: boolean;
workspaceName?: string;
orgName?: string;
version?: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ import {
RecordsInWorkspaceMentions,
BuildMode,
DevantMetadata,
GeneratedClientSaveResponse
GeneratedClientSaveResponse,
AddProjectToWorkspaceRequest
} from "./interfaces";
import { RequestType, NotificationType } from "vscode-messenger-common";

Expand All @@ -140,6 +141,7 @@ export const getEnclosedFunction: RequestType<BIGetEnclosedFunctionRequest, BIGe
export const getNodeTemplate: RequestType<BINodeTemplateRequest, BINodeTemplateResponse> = { method: `${_preFix}/getNodeTemplate` };
export const getAiSuggestions: RequestType<BIAiSuggestionsRequest, BIAiSuggestionsResponse> = { method: `${_preFix}/getAiSuggestions` };
export const createProject: NotificationType<ProjectRequest> = { method: `${_preFix}/createProject` };
export const addProjectToWorkspace: NotificationType<AddProjectToWorkspaceRequest> = { method: `${_preFix}/addProjectToWorkspace` };
export const getWorkspaces: RequestType<void, WorkspacesResponse> = { method: `${_preFix}/getWorkspaces` };
export const getProjectStructure: RequestType<void, ProjectStructureResponse> = { method: `${_preFix}/getProjectStructure` };
export const getProjectComponents: RequestType<void, ProjectComponentsResponse> = { method: `${_preFix}/getProjectComponents` };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export enum MACHINE_VIEW {
BIWelcome = "BI Welcome",
BIProjectForm = "BI Project SKIP",
BIImportIntegration = "BI Import Integration SKIP",
BIAddProjectForm = "BI Add Project SKIP",
BIComponentView = "BI Component View",
AddConnectionWizard = "Add Connection Wizard",
AddCustomConnector = "Add Custom Connector",
Expand Down Expand Up @@ -120,7 +121,8 @@ export type FocusFlowDiagramView = typeof FOCUS_FLOW_DIAGRAM_VIEW[keyof typeof F
export interface VisualizerLocation {
view?: MACHINE_VIEW | null;
documentUri?: string;
projectUri?: string;
projectPath?: string;
workspacePath?: string;
identifier?: string;
parentIdentifier?: string;
artifactType?: DIRECTORY_MAP;
Expand Down
4 changes: 2 additions & 2 deletions workspaces/ballerina/ballerina-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ All notable changes to the **Ballerina** extension will be documented in this fi

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased]
## [5.6.0](https://github.com/wso2/vscode-extensions/compare/ballerina-integrator-1.4.0...ballerina-integrator-1.5.0) - 2025-11-11

### Added

- **Editor** — Added visual editing for mono-repositories with multiple Ballerina projects, along with support for "Natural expressions" in Ballerina 2201.13.0.
- **Editor** — Added support for [Ballerina workspaces](https://ballerina.io/learn/workspaces/). This allows you to seamlessly manage, navigate, and build multiple related Ballerina projects within a single VS Code window, greatly improving the development workflow for complex systems.

## [5.5.0](https://github.com/wso2/vscode-extensions/compare/ballerina-integrator-1.3.2...ballerina-integrator-1.4.0) - 2025-11-05

Expand Down
4 changes: 2 additions & 2 deletions workspaces/ballerina/ballerina-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ballerina",
"displayName": "Ballerina",
"description": "Ballerina Language support, debugging, graphical visualization, AI-based data-mapping and many more.",
"version": "5.5.0",
"version": "5.6.0",
"publisher": "wso2",
"icon": "resources/images/ballerina.png",
"homepage": "https://wso2.com/ballerina/vscode/docs",
Expand Down Expand Up @@ -689,7 +689,7 @@
},
{
"command": "BI.project-explorer.add",
"title": "Add Construct",
"title": "Add Project",
"icon": "$(add)",
"group": "navigation",
"category": "BI"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ function downloadFile(url, outputPath, maxRedirects = 5) {
return;
}

console.log(`Following redirect to: ${res.headers.location}`);
makeRequest(res.headers.location, redirectCount + 1);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions workspaces/ballerina/ballerina-extension/src/RPCLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ async function getContext(): Promise<VisualizerLocation> {
position: context.position,
syntaxTree: context.syntaxTree,
isBI: context.isBI,
projectUri: context.projectUri,
projectPath: context.projectPath,
serviceType: context.serviceType,
type: context.type,
isGraphql: context.isGraphql,
Expand All @@ -140,7 +140,7 @@ async function getContext(): Promise<VisualizerLocation> {
metadata: {
isBISupported: context.isBISupported,
haveLS: StateMachine.langClient() && true,
recordFilePath: path.join(context.projectUri, "types.bal"),
recordFilePath: path.join(context.projectPath, "types.bal"),
enableSequenceDiagram: extension.ballerinaExtInstance.enableSequenceDiagramView(),
target: context.metadata?.target
},
Expand Down
12 changes: 5 additions & 7 deletions workspaces/ballerina/ballerina-extension/src/core/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2346,13 +2346,11 @@ export class BallerinaExtension {
public setPersistStatusContext(textEditor: TextEditor) {
if (textEditor?.document) {
const fileUri: Uri = textEditor.document.uri;
if (checkIsPersistModelFile(fileUri)) {
this.isPersist = true;
commands.executeCommand('setContext', 'isPersistModelActive', true);
return;
} else {
this.isPersist = false;
}
checkIsPersistModelFile(fileUri).then(isPersistModelFile => {
this.isPersist = isPersistModelFile;
commands.executeCommand('setContext', 'isPersistModelActive', isPersistModelFile);
});
return;
}
commands.executeCommand('setContext', 'isPersistModelActive', false);
}
Expand Down
2 changes: 1 addition & 1 deletion workspaces/ballerina/ballerina-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export async function activate(context: ExtensionContext) {
await StateMachine.initialize();

// Then return the ballerina extension context
return { ballerinaExtInstance: extension.ballerinaExtInstance, projectPath: StateMachine.context().projectUri };
return { ballerinaExtInstance: extension.ballerinaExtInstance, projectPath: StateMachine.context().projectPath };
}

export async function activateBallerina(): Promise<BallerinaExtension> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function activateAIFeatures(ballerinaExternalInstance: BallerinaExtension
});
}

const projectPath = StateMachine.context().projectUri;
const projectPath = StateMachine.context().projectPath;

commands.registerCommand(CONFIGURE_DEFAULT_MODEL_COMMAND, async (...args: any[]) => {
const configPath = await getConfigFilePath(ballerinaExternalInstance, projectPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ async function createTempBallerinaFile(
}

export async function createTempBallerinaDir(): Promise<string> {
const projectRoot = StateMachine.context().projectUri;
const projectRoot = StateMachine.context().projectPath;
const randomNum = Math.floor(Math.random() * 90000) + 10000;
const tempDir = fs.mkdtempSync(
path.join(os.tmpdir(), `ballerina-data-mapping-${randomNum}-`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export async function generateMappingCodeCore(mappingRequest: ProcessMappingPara
const biDiagramRpcManager = new BiDiagramRpcManager();
const langClient = StateMachine.langClient();
const context = StateMachine.context();
const projectRoot = context.projectUri;
const projectRoot = context.projectPath;

const targetFunctionName = mappingRequest.parameters.functionName;

Expand Down Expand Up @@ -443,9 +443,9 @@ export async function generateMappingCode(mappingRequest: ProcessMappingParamete
}

async function collectAllImportsFromProject(): Promise<ProjectImports> {
const projectUri = StateMachine.context().projectUri;
const projectPath = StateMachine.context().projectPath;

const ballerinaSourceFiles = await getBallerinaFiles(Uri.file(projectUri).fsPath);
const ballerinaSourceFiles = await getBallerinaFiles(Uri.file(projectPath).fsPath);

const importStatements: ImportStatements[] = [];

Expand All @@ -457,7 +457,7 @@ async function collectAllImportsFromProject(): Promise<ProjectImports> {
}

return {
projectPath: projectUri,
projectPath: projectPath,
imports: importStatements,
};
}
Expand Down Expand Up @@ -640,7 +640,7 @@ export async function generateInlineMappingCodeCore(inlineMappingRequest: Metada

const langClient = StateMachine.langClient();
const context = StateMachine.context();
const projectRoot = context.projectUri;
const projectRoot = context.projectPath;

const inlineMappingsResult: InlineMappingsSourceResult =
await generateInlineMappingsSource(inlineMappingRequest, langClient, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ import { DocGenerationRequest } from '@wso2/ballerina-core';
import { getServiceDeclaration } from '../../testGenerator';
import { generateDocumentation, DocumentationGenerationRequest } from './documentation';
import { getProjectSource, getOpenAPISpecification } from '../../utils';
import { StateMachine } from '../../../../stateMachine';
import { getCurrentProjectRoot } from '../../../../utils/project-utils';

// Main documentation generator function that handles all the logic
export async function generateDocumentationForService(params: DocGenerationRequest): Promise<void> {
try {
// Get the project root
const projectRoot = StateMachine.context().projectUri;
const projectPath = await getCurrentProjectRoot();

// Get the project source files
const projectSource = await getProjectSource(projectRoot);
const projectSource = await getProjectSource(projectPath);
if (!projectSource) {
throw new Error("The current project is not recognized as a valid Ballerina project. Please ensure you have opened a Ballerina project.");
}

// Find the service declaration and get OpenAPI spec
const { serviceDocFilePath } = await getServiceDeclaration(projectRoot, params.serviceName);
const { serviceDocFilePath } = await getServiceDeclaration(projectPath, params.serviceName);
const openApiSpec = await getOpenAPISpecification(serviceDocFilePath);

// Create the documentation generation request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { generateTest, getDiagnostics } from "../../testGenerator";
import { URI } from "vscode-uri";
import * as fs from "fs";
import { CopilotEventHandler, createWebviewEventHandler } from "../event";
import { StateMachine } from "../../../../stateMachine";
import { getCurrentProjectRoot } from "../../../../utils/project-utils";

// Core function test generation that emits events
export async function generateFunctionTestsCore(
Expand All @@ -39,8 +39,16 @@ export async function generateFunctionTestsCore(
content: `\n\n<progress>Generating tests for the function ${functionIdentifier}. This may take a moment.</progress>`,
});

const projectRoot = StateMachine.context().projectUri;
const response = await generateTest(projectRoot, {
let projectPath: string;
try {
projectPath = await getCurrentProjectRoot();
} catch (error) {
console.error("Error getting current project root:", error);
eventHandler({ type: "error", content: getErrorMessage(error) });
return;
}

const response = await generateTest(projectPath, {
targetType: TestGenerationTarget.Function,
targetIdentifier: functionIdentifier,
testPlan: params.testPlan,
Expand All @@ -63,7 +71,7 @@ export async function generateFunctionTestsCore(
? existingSource + "\n\n// >>>>>>>>>>>>>>TEST CASES NEED TO BE FIXED <<<<<<<<<<<<<<<\n\n" + response.testSource
: response.testSource;

const diagnostics = await getDiagnostics(projectRoot, {
const diagnostics = await getDiagnostics(projectPath, {
testSource: generatedFullSource,
});

Expand All @@ -78,7 +86,7 @@ export async function generateFunctionTestsCore(
content: `\n<progress>Refining tests based on feedback to ensure accuracy and reliability.</progress>`,
});

const fixedCode = await generateTest(projectRoot, {
const fixedCode = await generateTest(projectPath, {
targetType: TestGenerationTarget.Function,
targetIdentifier: functionIdentifier,
testPlan: params.testPlan,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { TestGenerationTarget, TestPlanGenerationRequest, Command } from "@wso2/
import { generateTest, getDiagnostics } from "../../testGenerator";
import { CopilotEventHandler, createWebviewEventHandler } from "../event";
import { AIPanelAbortController } from "../../../../../src/rpc-managers/ai-panel/utils";
import { StateMachine } from "../../../../stateMachine";
import { getCurrentProjectRoot } from "../../../../utils/project-utils";

export interface TestPlanResponse {
testPlan: string;
Expand Down Expand Up @@ -168,8 +168,15 @@ export async function generateTestPlanCore(
type: "content_block",
content: `\n\n<progress>Generating tests for the ${target} service. This may take a moment.</progress>`,
});
const projectRoot = StateMachine.context().projectUri;
const testResp = await generateTest(projectRoot, {
let projectPath: string;
try {
projectPath = await getCurrentProjectRoot();
} catch (error) {
console.error("Error getting current project root:", error);
eventHandler({ type: "error", content: getErrorMessage(error) });
return;
}
const testResp = await generateTest(projectPath, {
targetType: TestGenerationTarget.Service,
targetIdentifier: target,
testPlan: assistantResponse,
Expand All @@ -178,15 +185,15 @@ export async function generateTestPlanCore(
type: "content_block",
content: `\n<progress>Analyzing generated tests for potential issues.</progress>`,
});
const diagnostics = await getDiagnostics(projectRoot, testResp);
const diagnostics = await getDiagnostics(projectPath, testResp);
let testCode = testResp.testSource;
const testConfig = testResp.testConfig;
if (diagnostics.diagnostics.length > 0) {
eventHandler({
type: "content_block",
content: `\n<progress>Refining tests based on feedback to ensure accuracy and reliability.</progress>`,
});
const fixedCode = await generateTest(projectRoot, {
const fixedCode = await generateTest(projectPath, {
targetType: TestGenerationTarget.Service,
targetIdentifier: target,
testPlan: assistantResponse,
Expand Down
Loading
Loading