-
Notifications
You must be signed in to change notification settings - Fork 59
[BI Data Mapper] Improve completion support - frontend changes for expression bar #898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…lize targetLineRange
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds a dedicated Changes
Sequence DiagramsequenceDiagram
participant UI as FormGeneratorNew
participant Client as BiDiagramRpcClient
participant Manager as BiDiagramRpcManager
participant ExtLang as ExtendedLangClient
participant LS as Language Server
rect rgb(240, 248, 255)
Note over UI: isDataMapperEditor = true
UI->>Client: getDataMapperCompletions(params)
end
rect rgb(255, 250, 240)
Note over UI: isDataMapperEditor = false
UI->>Client: getExpressionCompletions(params)
end
Client->>Manager: messenger.request()
Manager->>ExtLang: getDataMapperCompletions(params)
ExtLang->>LS: /expressionEditor/dataMapperCompletion
LS-->>ExtLang: ExpressionCompletionsResponse
ExtLang-->>Manager: response
Manager-->>Client: response
Client-->>UI: CompletionItem[]
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
🧹 Nitpick comments (9)
workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts (1)
470-472: Consider initializingfocusInputRootMapbefore conditional processing.When
processInputsisfalse, themodel.focusInputRootMapmight be undefined since it's only initialized insideprocessInputRoots(line 490). While this may be acceptable if the type allows undefined, consider initializing it at the start ofexpandDMModelto ensure consistency.Consider applying this diff:
): ExpandedDMModel { const { processInputs = true, processOutput = true, processSubMappings = true, previousModel } = options; + // Initialize focusInputRootMap if not already present + if (!model.focusInputRootMap) { + model.focusInputRootMap = {}; + } + return { inputs: processInputs ? processInputRoots(model)workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClausesPanel.tsx (1)
84-84: Consider documenting the width increase rationale.The side panel width increased from 312 to 400 pixels. While this likely accommodates JOIN clause UI elements, consider whether this is the optimal width or if it should be configurable.
workspaces/ballerina/ballerina-visualizer/src/views/BI/Forms/FormGeneratorNew/index.tsx (1)
460-465: Clarify the default behavior whenisDataMapperEditoris undefined.The conditional logic branches on
!isDataMapperEditorto choose betweengetExpressionCompletionsandgetDataMapperCompletions. WhenisDataMapperEditorisundefined, it will callgetExpressionCompletions(since!undefinedistrue).Consider making this behavior explicit for clarity:
- if (!isDataMapperEditor) { - completions = await rpcClient.getBIDiagramRpcClient().getExpressionCompletions(completionRequest); - } else { - completions = await rpcClient.getBIDiagramRpcClient().getDataMapperCompletions(completionRequest); - } + if (isDataMapperEditor) { + completions = await rpcClient.getBIDiagramRpcClient().getDataMapperCompletions(completionRequest); + } else { + completions = await rpcClient.getBIDiagramRpcClient().getExpressionCompletions(completionRequest); + }workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClauseEditor.tsx (3)
34-38: Store access viagetState()is fine for initial data, but won’t react to later changesUsing
useDMQueryClausesPanelStore.getState()to read{ clauseToAdd, setClauseToAdd }is adequate ifClauseEditoris only ever mounted after the store has been primed (e.g., bymapWithJoin) and you just need initial values.If you ever need
ClauseEditorto react to subsequentclauseToAddchanges while it’s open (for example, reusing the same component instance for different clauses), you’ll want to switch to the hook form:const { clauseToAdd, setClauseToAdd } = useDMQueryClausesPanelStore();so it subscribes to store updates.
98-120: JOIN-on fields are wired correctly; consider pre-populating or validating laterThe new
lhsExpressionField/rhsExpressionFieldfor JOIN-on conditions are configured as non-optional in the form while defaulting to empty strings. That’s reasonable for a first iteration.At some point, you may want to:
- Pre-populate one side (typically LHS) from the source field when invoked from a link, or
- Add minimal validation on submit to prevent empty join-on conditions.
Not a blocker for this PR; the basics are in place.
122-163: JOIN submit normalization aligns with core types but may constrain future outer-join support
handleSubmitclearingclauseToAddand building:const clause: IntermediateClause = { type: clauseType as IntermediateClauseType, properties: data as IntermediateClauseProps }; if (clauseType === IntermediateClauseType.JOIN) { clause.properties.type = "var"; clause.properties.isOuter = false; }is consistent with the updated
IntermediateClauseProps(mandatoryexpression, optionalisOuter, etc.) and the ClauseEditor form, where JOIN does not render atypefield.For future outer-join support, you’ll likely want to:
- Add an
isOutercheckbox/select to the JOIN form, and- Stop hard-coding
isOuter = falseso user input isn’t overridden.For now, this is fine and clearly captures “inner join” semantics.
workspaces/ballerina/data-mapper/src/components/Diagram/utils/modification-utils.ts (1)
179-202: mapWithJoin correctly seeds the JOIN clause; consider minor hardeningThe new
mapWithJoin:
- Validates the presence of a source port.
- Derives a default JOIN clause with:
name:<fieldName>Itemtype:"var"expression:fieldFQNisOuter:falselhsExpression/rhsExpression:""- Opens the query clauses panel via the shared store.
This lines up with the updated
IntermediateClause/IntermediateClausePropsand the new JOIN handling inClauseEditor.Two minor robustness tweaks to consider (non-blocking):
- Guard against missing
fieldmetadata on the port to avoid runtime errors in unusual cases:const field = sourcePortModel.attributes.field; if (!field) { return; } setClauseToAdd({ // ... properties: { name: field.name + "Item", expression: sourcePortModel.attributes.fieldFQN, // ... } });
- In future, you might pre-populate at least one of
lhsExpression/rhsExpressionto a sensible default based on the current mapping context to reduce user effort.workspaces/ballerina/ballerina-visualizer/src/views/DataMapper/DataMapperView.tsx (1)
575-617: Completion request now carries accurate cursor and location contextThe updated debounced
retrieveCompeletions:
- Extracts
lineOffset/charOffsetviacalculateExpressionOffsets(value, cursorPosition).- Derives
startLinefromproperty.codedata.lineRangeandexpressionOffsetRefusingupdateLineRange, which lets you account for imports or other edits shifting the expression.- Calls
getDataMapperCompletionswith a context that includes:
- The full
expression,startLine,lineOffset, andoffset,- The current
viewState.codedata,- The resolved
propertyfromgetProperty.This is exactly the kind of richer context needed to get correct cursor-relative completions for the expression bar and integrates cleanly with the new BI diagram completions API.
One thing to keep an eye on:
property.codedatais assumed to be non-null here. If the backend ever returns a property withoutcodedata, this would throw. If that’s a realistic scenario, a defensive early return when!property.codedatacould be added later.workspaces/ballerina/data-mapper/src/components/Diagram/Diagram.tsx (1)
39-40: ClauseConnectorNode integration into the diagram engine looks correctIncluding
ClauseConnectorNodein the node imports, factory registration, and the repositioning pass (filtering byinstanceofand usingtargetMappedPortfor coordinates) is consistent with howLinkConnectorNodeandQueryExprConnectorNodeare handled. This should keep clause connectors aligned with their target output ports without changing existing behavior.If you later refactor positioning, it might be worth centralizing this into a shared helper (e.g., a polymorphic
updatePositionon connector nodes) instead of hard‑coding offsets in the effect, but not required for this PR.Also applies to: 82-91, 157-165
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (43)
workspaces/ballerina/ballerina-core/src/interfaces/data-mapper.ts(5 hunks)workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/index.ts(1 hunks)workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/rpc-type.ts(1 hunks)workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts(3 hunks)workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-handler.ts(2 hunks)workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts(2 hunks)workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts(3 hunks)workspaces/ballerina/ballerina-rpc-client/src/rpc-clients/bi-diagram/rpc-client.ts(2 hunks)workspaces/ballerina/ballerina-visualizer/src/views/BI/Forms/FormGeneratorNew/index.tsx(5 hunks)workspaces/ballerina/ballerina-visualizer/src/views/DataMapper/DataMapperView.tsx(3 hunks)workspaces/ballerina/data-mapper/src/components/DataMapper/DataMapperEditor.tsx(2 hunks)workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClauseEditor.tsx(6 hunks)workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClausesPanel.tsx(3 hunks)workspaces/ballerina/data-mapper/src/components/DataMapper/Views/DataMapperView.ts(1 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Actions/IONodesScrollCanvasAction.ts(2 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Actions/utils.ts(2 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Diagram.tsx(3 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Label/ExpressionLabelFactory.tsx(2 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Label/ExpressionLabelModel.ts(0 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Label/QueryExprLabelWidget.tsx(0 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Link/DataMapperLink/DataMapperLink.ts(1 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/LinkState/CreateLinkState.ts(4 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNode.ts(1 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNodeFactory.tsx(1 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNodeWidget.tsx(1 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/index.ts(1 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Node/Input/InputNode.ts(1 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Node/QueryExprConnector/QueryExprConnectorNodeWidget.tsx(1 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Node/QueryOutput/QueryOutputNode.ts(0 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Node/commons/DataMapperNode.ts(1 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Node/index.ts(1 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/Port/model/InputOutputPortModel.ts(2 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/hooks/useDiagramModel.ts(2 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/utils/common-utils.ts(3 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/utils/focus-positioning-utils.ts(2 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/utils/modification-utils.ts(2 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/utils/node-utils.ts(1 hunks)workspaces/ballerina/data-mapper/src/components/Diagram/utils/port-utils.ts(1 hunks)workspaces/ballerina/data-mapper/src/store/store.ts(2 hunks)workspaces/ballerina/data-mapper/src/utils/DataMapperContext/DataMapperContext.ts(2 hunks)workspaces/ballerina/data-mapper/src/utils/model-utils.ts(3 hunks)workspaces/ballerina/data-mapper/src/visitors/BaseVisitor.ts(2 hunks)workspaces/ballerina/data-mapper/src/visitors/IntermediateNodeInitVisitor.ts(2 hunks)
💤 Files with no reviewable changes (3)
- workspaces/ballerina/data-mapper/src/components/Diagram/Label/QueryExprLabelWidget.tsx
- workspaces/ballerina/data-mapper/src/components/Diagram/Label/ExpressionLabelModel.ts
- workspaces/ballerina/data-mapper/src/components/Diagram/Node/QueryOutput/QueryOutputNode.ts
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-11-10T15:05:11.309Z
Learnt from: madushajg
Repo: wso2/vscode-extensions PR: 868
File: workspaces/bi/bi-extension/src/utils.ts:224-242
Timestamp: 2025-11-10T15:05:11.309Z
Learning: The workspaces/bi/bi-extension and workspaces/ballerina/ballerina-extension are separate VS Code extensions that are packaged and distributed independently, so they cannot share code via imports and must maintain their own implementations of common utilities.
Applied to files:
workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts
📚 Learning: 2025-11-10T15:04:50.474Z
Learnt from: madushajg
Repo: wso2/vscode-extensions PR: 868
File: workspaces/bi/bi-extension/src/utils.ts:153-169
Timestamp: 2025-11-10T15:04:50.474Z
Learning: The workspaces/bi/bi-extension and workspaces/ballerina/ballerina-extension are separate, independently deployable VSCode extensions in the wso2/vscode-extensions repository. Code duplication between these extensions is acceptable and often necessary to maintain their independence, rather than creating cross-extension dependencies.
Applied to files:
workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts
🧬 Code graph analysis (30)
workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/rpc-type.ts (4)
workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts (1)
getDataMapperCompletions(1127-1129)workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts (1)
getDataMapperCompletions(856-867)workspaces/ballerina/ballerina-rpc-client/src/rpc-clients/bi-diagram/rpc-client.ts (1)
getDataMapperCompletions(306-308)workspaces/ballerina/ballerina-core/src/interfaces/extended-lang-client.ts (2)
ExpressionCompletionsRequest(1088-1095)ExpressionCompletionsResponse(1112-1112)
workspaces/ballerina/data-mapper/src/components/Diagram/utils/port-utils.ts (2)
workspaces/ballerina/data-mapper/src/components/Diagram/Node/Input/InputNode.ts (1)
InputNode(29-160)workspaces/ballerina/data-mapper/src/components/Diagram/Port/model/InputOutputPortModel.ts (1)
InputOutputPortModel(54-123)
workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNodeWidget.tsx (5)
workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNode.ts (1)
ClauseConnectorNode(36-187)workspaces/ballerina/data-mapper/src/components/styles.ts (1)
useIntermediateNodeStyles(297-336)workspaces/ballerina/data-mapper/src/store/store.ts (2)
useDMExpressionBarStore(135-161)useDMQueryClausesPanelStore(171-180)workspaces/ballerina/data-mapper/src/components/Diagram/Node/LinkConnector/LinkConnectorWidgetComponents.tsx (1)
renderPortWidget(26-32)workspaces/common-libs/ui-toolkit/src/components/Codicon/Codicon.tsx (1)
Codicon(44-56)
workspaces/ballerina/data-mapper/src/components/Diagram/Node/QueryExprConnector/QueryExprConnectorNodeWidget.tsx (1)
workspaces/ballerina/data-mapper/src/components/Diagram/utils/common-utils.ts (1)
expandArrayFn(226-266)
workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNodeFactory.tsx (2)
workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNode.ts (2)
ClauseConnectorNode(36-187)CLAUSE_CONNECTOR_NODE_TYPE(33-33)workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNodeWidget.tsx (1)
ClauseConnectorNodeWidget(35-84)
workspaces/ballerina/data-mapper/src/store/store.ts (1)
workspaces/ballerina/ballerina-core/src/interfaces/data-mapper.ts (1)
IntermediateClause(216-219)
workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClausesPanel.tsx (1)
workspaces/ballerina/data-mapper/src/store/store.ts (1)
useDMQueryClausesPanelStore(171-180)
workspaces/ballerina/data-mapper/src/components/Diagram/Actions/utils.ts (1)
workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNode.ts (1)
ClauseConnectorNode(36-187)
workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/index.ts (1)
workspaces/ballerina/ballerina-core/src/interfaces/extended-lang-client.ts (2)
ExpressionCompletionsRequest(1088-1095)ExpressionCompletionsResponse(1112-1112)
workspaces/ballerina/data-mapper/src/components/Diagram/Diagram.tsx (1)
workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNode.ts (1)
ClauseConnectorNode(36-187)
workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts (1)
workspaces/ballerina/ballerina-core/src/interfaces/data-mapper.ts (1)
DMModel(131-144)
workspaces/ballerina/data-mapper/src/components/Diagram/Actions/IONodesScrollCanvasAction.ts (1)
workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNode.ts (1)
ClauseConnectorNode(36-187)
workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts (2)
workspaces/ballerina/ballerina-core/src/interfaces/extended-lang-client.ts (2)
ExpressionCompletionsRequest(1088-1095)ExpressionCompletionsResponse(1112-1112)workspaces/ballerina/ballerina-extension/src/stateMachine.ts (1)
StateMachine(653-676)
workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-handler.ts (5)
workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts (1)
getDataMapperCompletions(1127-1129)workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts (1)
getDataMapperCompletions(856-867)workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/rpc-type.ts (1)
getDataMapperCompletions(152-152)workspaces/ballerina/ballerina-rpc-client/src/rpc-clients/bi-diagram/rpc-client.ts (1)
getDataMapperCompletions(306-308)workspaces/ballerina/ballerina-core/src/interfaces/extended-lang-client.ts (1)
ExpressionCompletionsRequest(1088-1095)
workspaces/ballerina/data-mapper/src/components/Diagram/LinkState/CreateLinkState.ts (2)
workspaces/ballerina/data-mapper/src/components/Diagram/Port/model/InputOutputPortModel.ts (1)
InputOutputPortModel(54-123)workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNode.ts (1)
ClauseConnectorNode(36-187)
workspaces/ballerina/data-mapper/src/components/Diagram/utils/node-utils.ts (2)
workspaces/ballerina/data-mapper/src/components/DataMapper/Views/DataMapperView.ts (1)
View(18-23)workspaces/ballerina/data-mapper/src/components/Diagram/Node/Input/InputNode.ts (1)
InputNode(29-160)
workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNode.ts (8)
workspaces/ballerina/data-mapper/src/components/Diagram/Port/model/InputOutputPortModel.ts (1)
InputOutputPortModel(54-123)workspaces/ballerina/ballerina-core/src/interfaces/data-mapper.ts (1)
DMDiagnostic(70-83)workspaces/ballerina/data-mapper/src/utils/DataMapperContext/DataMapperContext.ts (1)
IDataMapperContext(21-35)workspaces/ballerina/data-mapper/src/store/store.ts (1)
useDMSearchStore(83-89)workspaces/ballerina/data-mapper/src/components/Diagram/utils/node-utils.ts (1)
findInputNode(23-47)workspaces/ballerina/data-mapper/src/components/Diagram/utils/port-utils.ts (2)
getInputPort(26-37)getTargetPortPrefix(60-73)workspaces/ballerina/data-mapper/src/components/Diagram/Node/QueryOutput/QueryOutputNode.ts (1)
QueryOutputNode(37-186)workspaces/ballerina/data-mapper/src/components/Diagram/Link/DataMapperLink/DataMapperLink.ts (1)
DataMapperLinkModel(37-95)
workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClauseEditor.tsx (2)
workspaces/ballerina/data-mapper/src/store/store.ts (1)
useDMQueryClausesPanelStore(171-180)workspaces/ballerina/ballerina-core/src/interfaces/data-mapper.ts (4)
DMFormField(260-272)DMFormFieldValues(274-276)IntermediateClause(216-219)IntermediateClauseProps(206-214)
workspaces/ballerina/data-mapper/src/visitors/IntermediateNodeInitVisitor.ts (2)
workspaces/ballerina/ballerina-core/src/interfaces/data-mapper.ts (1)
Query(191-198)workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNode.ts (1)
ClauseConnectorNode(36-187)
workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts (1)
workspaces/ballerina/ballerina-core/src/interfaces/extended-lang-client.ts (2)
ExpressionCompletionsRequest(1088-1095)ExpressionCompletionsResponse(1112-1112)
workspaces/ballerina/data-mapper/src/components/Diagram/utils/focus-positioning-utils.ts (1)
workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNode.ts (1)
ClauseConnectorNode(36-187)
workspaces/ballerina/data-mapper/src/components/DataMapper/DataMapperEditor.tsx (1)
workspaces/ballerina/data-mapper/src/components/DataMapper/Views/DataMapperView.ts (1)
View(18-23)
workspaces/ballerina/data-mapper/src/visitors/BaseVisitor.ts (1)
workspaces/ballerina/ballerina-core/src/interfaces/data-mapper.ts (1)
ExpandedDMModel(118-129)
workspaces/ballerina/data-mapper/src/components/Diagram/utils/modification-utils.ts (3)
workspaces/ballerina/data-mapper/src/components/Diagram/utils/common-utils.ts (1)
expandArrayFn(226-266)workspaces/ballerina/data-mapper/src/components/Diagram/Port/model/InputOutputPortModel.ts (1)
InputOutputPortModel(54-123)workspaces/ballerina/data-mapper/src/store/store.ts (1)
useDMQueryClausesPanelStore(171-180)
workspaces/ballerina/ballerina-rpc-client/src/rpc-clients/bi-diagram/rpc-client.ts (4)
workspaces/ballerina/ballerina-core/src/interfaces/extended-lang-client.ts (2)
ExpressionCompletionsRequest(1088-1095)ExpressionCompletionsResponse(1112-1112)workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts (1)
getDataMapperCompletions(1127-1129)workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts (1)
getDataMapperCompletions(856-867)workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/rpc-type.ts (1)
getDataMapperCompletions(152-152)
workspaces/ballerina/data-mapper/src/components/Diagram/Port/model/InputOutputPortModel.ts (1)
workspaces/ballerina/data-mapper/src/components/Diagram/utils/modification-utils.ts (1)
mapWithJoin(179-202)
workspaces/ballerina/data-mapper/src/components/Diagram/utils/common-utils.ts (1)
workspaces/ballerina/data-mapper/src/utils/DataMapperContext/DataMapperContext.ts (1)
IDataMapperContext(21-35)
workspaces/ballerina/data-mapper/src/utils/model-utils.ts (2)
workspaces/ballerina/ballerina-core/src/interfaces/data-mapper.ts (1)
ExpandedDMModel(118-129)workspaces/ballerina/data-mapper/src/visitors/BaseVisitor.ts (1)
BaseVisitor(21-40)
workspaces/ballerina/ballerina-visualizer/src/views/DataMapper/DataMapperView.tsx (1)
workspaces/ballerina/ballerina-visualizer/src/utils/bi.tsx (1)
updateLineRange(538-557)
workspaces/ballerina/ballerina-visualizer/src/views/BI/Forms/FormGeneratorNew/index.tsx (1)
workspaces/ballerina/ballerina-core/src/interfaces/extended-lang-client.ts (2)
ExpressionCompletionsRequest(1088-1095)ExpressionCompletionsResponse(1112-1112)
🔇 Additional comments (36)
workspaces/ballerina/ballerina-extension/src/rpc-managers/data-mapper/utils.ts (2)
490-500: LGTM! Clear tracking of input roots during traversal.The initialization of
focusInputRootMapfollowed by settingtraversingRootfor each input provides a clean mechanism to track which root input is being processed. The shallow copy behavior ensures that mutations tofocusInputRootMapare properly propagated.
609-611: LGTM! Correctly tracks focus input to root mapping.The conditional check ensures
traversingRootis set before recording the mapping, and the logic correctly associates focused fields with their originating root input.workspaces/ballerina/data-mapper/src/components/Diagram/hooks/useDiagramModel.ts (1)
103-104: LGTM - Dependency array correctly updated.Adding
queryIOsto the dependency array ensures the diagram model refetches when query inputs or outputs change, which aligns with the PR objective to improve completion support. This follows the established pattern used for other dependencies likemappingsandsubMappings.Note: The correctness of this dependency relies on the proper serialization of
queryIOsat line 50. Please address the concerns raised in the previous comment.workspaces/ballerina/data-mapper/src/components/Diagram/Node/QueryExprConnector/QueryExprConnectorNodeWidget.tsx (1)
76-76: LGTM! Multi-input expansion now supported.The change correctly passes the entire
mapping.inputsarray toexpandArrayFn, aligning with its updated signature that acceptsinputIds: string[]. This enables JOIN clause support by expanding based on multiple inputs.workspaces/ballerina/data-mapper/src/components/DataMapper/DataMapperEditor.tsx (2)
153-153: Good addition of explicit type annotation.Adding the
View[]type annotation improves code clarity and type safety.
228-242: Constructor signature matches call site correctly.The
DataMapperContextconstructor signature (lines 39-52 inworkspaces/ballerina/data-mapper/src/utils/DataMapperContext/DataMapperContext.ts) shows thathasInputsOutputsChangedis at position 3, which matches the call site in DataMapperEditor.tsx. All 13 parameters are in the correct order.workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/index.ts (1)
18-20: LGTM! Standard barrel export pattern.The file follows the standard barrel export pattern for aggregating public ClauseConnector module exports, consistent with other Node module exports in the codebase.
workspaces/ballerina/data-mapper/src/components/Diagram/Actions/IONodesScrollCanvasAction.ts (2)
30-30: LGTM! Import added for ClauseConnectorNode.The import correctly adds
ClauseConnectorNodeto support the new intermediate node type in repositioning logic.
164-164: LGTM! Repositioning logic extended for ClauseConnectorNode.The instanceof check now includes
ClauseConnectorNode, ensuring it's repositioned consistently with other intermediate connector nodes when the output node scrolls.workspaces/ballerina/data-mapper/src/components/Diagram/Actions/utils.ts (2)
28-29: LGTM! Imports updated for new node types.The imports correctly add
SubMappingNodeandClauseConnectorNode. Note thatSubMappingNodeis already part of theINPUT_NODESarray on line 36.
48-49: LGTM! ClauseConnectorNode added to intermediate nodes.The addition of
ClauseConnectorNodeto theINTERMEDIATE_NODESarray properly extends the intermediate node handling, consistent with its role alongsideLinkConnectorNodeandQueryExprConnectorNode.workspaces/ballerina/data-mapper/src/components/Diagram/Node/index.ts (1)
28-28: LGTM! ClauseConnector added to public API.The export statement correctly adds
ClauseConnectorto the Node module's public API, consistent with the barrel export pattern used for other node types.workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-handler.ts (2)
76-76: LGTM! Import added for data mapper completions.The import correctly adds
getDataMapperCompletionsto support the new data mapper-specific completions endpoint.
182-182: LGTM! RPC handler registered for data mapper completions.The handler registration correctly wires
getDataMapperCompletionsrequests to the RPC manager, following the same pattern as the existinggetExpressionCompletionshandler. This directly supports the PR objective to improve completion support for the expression bar.workspaces/ballerina/data-mapper/src/components/Diagram/Link/DataMapperLink/DataMapperLink.ts (1)
31-31: LGTM! ArrayJoin mapping type added.The
ArrayJoinenum member correctly extendsMappingTypeto support JOIN clause scenarios in the data mapper. This aligns with the broader JOIN support introduced in this PR.workspaces/ballerina/data-mapper/src/components/Diagram/utils/focus-positioning-utils.ts (1)
20-20: LGTM! Consistent extension for ClauseConnectorNode support.The addition of
ClauseConnectorNodeto the imports and type assertion follows the established pattern for intermediate nodes (LinkConnectorNode,QueryExprConnectorNode). The implementation correctly enables target node resolution throughClauseConnectorNodeintermediates.Also applies to: 160-160
workspaces/ballerina/data-mapper/src/components/Diagram/Port/model/InputOutputPortModel.ts (1)
78-80: LGTM! Proper handling for ArrayJoin mapping flow.The special-case handling for
MappingType.ArrayJoincorrectly delegates tomapWithJoin()and returns early to prevent automatic mapping creation. This aligns with the JOIN clause UI flow where users configure the join properties before the mapping is created.workspaces/ballerina/data-mapper/src/components/Diagram/Node/commons/DataMapperNode.ts (1)
383-391: Verify behavior change in array member field resolution.The simplified logic now directly uses
attributes.field?.memberinstead of a dedicated resolver method. Per the AI summary, this removes focused-member resolution during array field port creation, which could alter behavior when focusing is involved in array contexts.Confirm that removing the focused-member resolution path doesn't break existing array-related focus scenarios or JOIN flows.
workspaces/ballerina/data-mapper/src/utils/model-utils.ts (1)
46-49: LGTM! Proper Query traversal implementation.The addition of Query traversal follows the established visitor pattern correctly, with
beginVisitQueryandendVisitQueryhooks properly called. The traversal is appropriately positioned after sub-mappings, maintaining the expected visitation order.Also applies to: 85-88
workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/index.ts (1)
149-149: LGTM! Dedicated completions endpoint for data mapper context.The new
getDataMapperCompletionsmethod provides a data mapper-specific completions endpoint, which aligns with the PR objective to include correct cursor positioning for the expression bar. While it shares the same signature asgetExpressionCompletions, having a dedicated endpoint allows for context-specific completion logic.workspaces/ballerina/data-mapper/src/components/Diagram/Label/ExpressionLabelFactory.tsx (1)
38-43: LGTM! Appropriate conditional rendering for pending mappings.The logic correctly handles pending mapping types:
MappingType.ArrayJoinreturns an empty fragment (no inline label) since the JOIN configuration uses the side panel flow- Other pending types display
MappingOptionsWidgetfor inline configuration- Non-pending mappings continue to render
ExpressionLabelWidgetas beforeThe empty fragment for ArrayJoin aligns with the user flow where JOIN clauses are configured via the Query Filters panel rather than inline labels.
workspaces/ballerina/data-mapper/src/components/DataMapper/Views/DataMapperView.ts (1)
20-20: Interface change successfully migrated with all consumers properly updated.Verification confirms the interface change from
sourceField?: stringtosourceFields?: string[]is complete and correct:
- Interface defined correctly in DataMapperView.ts
- View instantiation in common-utils.ts properly creates the array via
sourceFields: inputIds- Consumer in InputNode.ts correctly handles it with
.flatMap(view => view.sourceFields)No remaining singular property references found.
workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/rpc-type.ts (1)
152-152: LGTM!The new
getDataMapperCompletionsendpoint follows the same pattern asgetExpressionCompletionsand reuses the same request/response types, which promotes consistency and code reuse.workspaces/ballerina/data-mapper/src/components/Diagram/utils/port-utils.ts (1)
26-37: LGTM!The function signature extension to support
SubMappingNodeis well-implemented:
- Uses a type union for flexibility
- Branches cleanly on
instanceofto compute the appropriate portId- Maintains backward compatibility for
InputNodeworkspaces/ballerina/data-mapper/src/visitors/IntermediateNodeInitVisitor.ts (1)
47-50: LGTM!The new
beginVisitQuerymethod follows the visitor pattern consistently and correctly instantiates aClauseConnectorNodefor query processing.workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts (1)
856-867: LGTM!The
getDataMapperCompletionsmethod implementation correctly mirrors the existinggetExpressionCompletionspattern with appropriate error messaging specific to data mapper completions.workspaces/ballerina/data-mapper/src/visitors/BaseVisitor.ts (1)
37-38: LGTM!The new
beginVisitQueryandendVisitQueryoptional methods follow the established visitor pattern and are consistent with other visitor hooks in the interface.workspaces/ballerina/ballerina-visualizer/src/views/BI/Forms/FormGeneratorNew/index.tsx (1)
444-458: LGTM!The restructured completion request using
ExpressionCompletionsRequestobject is cleaner and more maintainable than passing individual parameters. The request correctly includes:
- File path
- Expression context with proper offsets
- Completion context with trigger information
workspaces/ballerina/data-mapper/src/components/Diagram/Node/Input/InputNode.ts (1)
58-58: Breaking change fromsourceFieldtosourceFieldshas been properly implemented.Verification confirms:
Interface updated: The
Viewinterface atworkspaces/ballerina/data-mapper/src/components/DataMapper/Views/DataMapperView.tsline 20 correctly definessourceFields?: string[](plural, optional array).Code updated: The usage at
InputNode.tsline 58 correctly callsview.sourceFieldswithflatMap, which appropriately handles the array structure and chains with.filter(Boolean)to handle undefined/null values.No legacy references: No remaining references to the old singular
sourceFieldpattern were found in the Ballerina data-mapper codebase.The optional property provides backward compatibility while supporting the new plural array structure.
workspaces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClauseEditor.tsx (1)
49-83: JOIN-specific field labels and docs are consistent with the new clause semanticsThe dynamic labels/documentation for
name(Item Alias) andexpression(Join With Collection) whenclauseType === IntermediateClauseType.JOINlook consistent with the backendIntermediateClauseProps(whereexpressionis the join collection andnameis the item alias).No issues from a behavior perspective; this should improve UX without impacting non-JOIN clauses.
workspaces/ballerina/data-mapper/src/components/Diagram/utils/modification-utils.ts (1)
153-177: expandArrayFn call matches new API and preserves existing behaviorUpdating
mapWithQueryto call:expandArrayFn(context, [input], output, viewId);is consistent with the new
expandArrayFn(context, inputIds: string[], ...)signature. Passing[input]preserves the previous single-input semantics while allowing future multi-input expansion.No issues here.
workspaces/ballerina/ballerina-visualizer/src/views/DataMapper/DataMapperView.tsx (2)
281-289: Passing targetLineRange to FormGeneratorNew correctly propagates source locationWiring
targetLineRange={viewState.codedata.lineRange}intoFormGeneratorNewaligns with the updatedDMFormPropsand ensures forms have access to the underlying source location, which is useful for things like context-aware completions and navigation.Given
viewState.codedatais already required for RPC calls in this view, reusing itslineRangehere is consistent.
717-722: Including query.inputs in the model signature is a sensible trigger for re-expansionUpdating
getModelSignatureto:inputs: [...model.inputs.map(i => i.name), ...(model.query?.inputs || [])],ensures that changes to query inputs (e.g., from JOIN/FROM clauses) participate in the signature comparison, so downstream logic will reprocess the expanded model when query inputs change.
This is a good, minimal way to keep the expanded model in sync without over-triggering.
workspaces/ballerina/ballerina-core/src/interfaces/data-mapper.ts (1)
56-63: Interface extensions for JOIN, focus roots, and form codedata are coherent and backward compatibleThe additions in this file are internally consistent and align with how they’re consumed elsewhere in the PR:
IntermediateClauseType.JOIN = "join"matches the new JOIN clause flows (ClauseEditor, mapWithJoin, etc.).IntermediateClausePropsnow exposeslhsExpression?,rhsExpression?, andisOuter?, which map directly to the JOIN form fields and submit normalization.ExpandedDMModel/DMModelgain optionalfocusInputRootMap(andDMModel.traversingRoot?), giving the diagram layer a place to track focus roots without impacting existing callers.DMFormField.codedata?provides a hook for attaching source metadata to individual form fields, used by the new completion flows.All new properties are optional, so existing consumers remain source- and binary-compatible.
Also applies to: 118-129, 131-144, 206-214, 260-272
workspaces/ballerina/data-mapper/src/components/Diagram/utils/common-utils.ts (1)
226-265: All call sites are correctly updated with array arguments—no migration neededVerification confirms both callers of
expandArrayFnare already passing arrays:
- modification-utils.ts:176:
expandArrayFn(context, [input], output, viewId)— explicitly wraps single input in array- QueryExprConnectorNodeWidget.tsx:76:
expandArrayFn(context, mapping.inputs, mapping.output, lastView.targetField)—mapping.inputsis already an array (typeMappinghasinputsas array, confirmed by.join('_')usage throughout the codebase)The function signature is consistent with both call sites. No runtime surprises expected.
workspaces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNodeWidget.tsx (1)
35-41: Widget wiring and diagnostics behavior look consistentThe widget correctly wires intermediate ports, opens the clause panel via the store, and reuses
DiagnosticWidgetto route error clicks into the expression bar, mirroring existing connector widgets. Data‑test IDs and styling hooks align with the rest of the diagram.Also applies to: 60-81
...aces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClausesPanel.tsx
Show resolved
Hide resolved
workspaces/ballerina/data-mapper/src/components/Diagram/hooks/useDiagramModel.ts
Show resolved
Hide resolved
workspaces/ballerina/data-mapper/src/components/Diagram/LinkState/CreateLinkState.ts
Show resolved
Hide resolved
...ces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNode.ts
Show resolved
Hide resolved
...erina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNodeFactory.tsx
Show resolved
Hide resolved
...lerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNodeWidget.tsx
Show resolved
Hide resolved
workspaces/ballerina/data-mapper/src/components/Diagram/utils/common-utils.ts
Show resolved
Hide resolved
workspaces/ballerina/data-mapper/src/components/Diagram/utils/node-utils.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the data mapper functionality with JOIN clause support for relational queries and improves expression bar completion capabilities. The changes introduce a new data mapper-specific completions API to provide better autocomplete support, extend query clauses to support JOIN operations with LHS/RHS expressions, and refactor the data flow to track multiple input sources.
- Added JOIN clause type with dedicated UI components and expressions for join conditions
- Introduced
getDataMapperCompletionsRPC API endpoint for enhanced expression editor autocomplete - Refactored input tracking from single
sourceFieldto multiplesourceFieldswith focus root mapping
Reviewed Changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
IntermediateNodeInitVisitor.ts |
Added visitor method for Query nodes to initialize ClauseConnector nodes |
BaseVisitor.ts |
Extended interface with Query traversal methods |
model-utils.ts |
Added Query traversal logic to node traversal |
DataMapperContext.ts |
Reordered constructor parameters for consistency |
store.ts |
Added clauseToAdd state for managing JOIN clause creation |
port-utils.ts |
Extended getInputPort to accept SubMappingNode |
node-utils.ts |
Refactored findInputNode to use focusInputRootMap for improved input tracking |
modification-utils.ts |
Added mapWithJoin function to handle JOIN mapping type |
focus-positioning-utils.ts |
Added ClauseConnectorNode to intermediate node type checks |
common-utils.ts |
Added ArrayJoin mapping type detection and changed expandArrayFn to accept multiple input IDs |
useDiagramModel.ts |
Added query I/O to dependency array for model regeneration |
InputOutputPortModel.ts |
Added handling for ArrayJoin mapping type |
Node/index.ts |
Exported ClauseConnector components |
DataMapperNode.ts |
Removed resolveArrayMemberField method (unused after focusedMemberId removal) |
QueryOutputNode.ts |
Removed manual query input-to-output link creation |
QueryExprConnectorNodeWidget.tsx |
Changed to pass multiple inputs to expandArrayFn |
InputNode.ts |
Changed to use sourceFields array and removed focusedMemberId logic |
ClauseConnector/index.ts |
New file exporting ClauseConnector components |
ClauseConnectorNodeWidget.tsx |
New widget component for rendering clause connector nodes |
ClauseConnectorNodeFactory.tsx |
New factory for creating ClauseConnector node widgets |
ClauseConnectorNode.ts |
New node model for representing query clauses in the diagram |
CreateLinkState.ts |
Added ClauseConnectorNode handling and removed query header port checks |
DataMapperLink.ts |
Added ArrayJoin mapping type enum value |
QueryExprLabelWidget.tsx |
Removed file (functionality moved to ClauseConnectorNode) |
ExpressionLabelModel.ts |
Removed isQuery property |
ExpressionLabelFactory.tsx |
Removed QueryExprLabelWidget rendering, added ArrayJoin handling |
Diagram.tsx |
Registered ClauseConnectorNodeFactory and added ClauseConnectorNode to repositioning logic |
Actions/utils.ts |
Added ClauseConnectorNode to intermediate nodes list |
IONodesScrollCanvasAction.ts |
Added ClauseConnectorNode to repositioning logic |
DataMapperView.ts |
Changed to use sourceFields array in View interface |
ClausesPanel.tsx |
Added width increase, useEffect for clauseToAdd initialization |
ClauseEditor.tsx |
Added JOIN clause support with LHS/RHS expression fields and dynamic labels |
DataMapperEditor.tsx |
Added View type annotation and reordered context constructor parameters |
DataMapperView.tsx |
Changed to use getDataMapperCompletions API and updated property handling |
FormGeneratorNew/index.tsx |
Added isDataMapperEditor flag to conditionally use data mapper completions API |
rpc-client.ts |
Added getDataMapperCompletions RPC method |
utils.ts |
Added focusInputRootMap to expanded model and populated it during input processing |
rpc-manager.ts |
Implemented getDataMapperCompletions handler |
rpc-handler.ts |
Registered getDataMapperCompletions RPC endpoint |
extended-language-client.ts |
Added getDataMapperCompletions method and renamed API constant |
rpc-type.ts |
Added getDataMapperCompletions request type |
bi-diagram/index.ts |
Added getDataMapperCompletions to API interface |
data-mapper.ts |
Added JOIN clause type, LHS/RHS expression properties, removed focusedMemberId, added focusInputRootMap and codedata to form field |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...aces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClauseEditor.tsx
Outdated
Show resolved
Hide resolved
...aces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClauseEditor.tsx
Show resolved
Hide resolved
workspaces/ballerina/data-mapper/src/components/Diagram/Label/ExpressionLabelFactory.tsx
Show resolved
Hide resolved
...aces/ballerina/data-mapper/src/components/DataMapper/SidePanel/QueryClauses/ClausesPanel.tsx
Show resolved
Hide resolved
...ces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNode.ts
Outdated
Show resolved
Hide resolved
...ces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNode.ts
Outdated
Show resolved
Hide resolved
...ces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNode.ts
Outdated
Show resolved
Hide resolved
...lerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNodeWidget.tsx
Outdated
Show resolved
Hide resolved
...ces/ballerina/data-mapper/src/components/Diagram/Node/ClauseConnector/ClauseConnectorNode.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
workspaces/ballerina/ballerina-visualizer/src/views/DataMapper/DataMapperView.tsx (2)
281-289: Passing targetLineRange into FormGeneratorNew aligns the editor stateUsing
targetLineRange={viewState.codedata.lineRange}gives the form/expression bar the precise range to work with, which should help cursor-aware features like completions behave correctly. If there are any flows wherecodedata.lineRangecan be absent, consider a small guard or fallback to avoid runtime errors in those edge cases.
575-645: Data Mapper completion request now uses property-codedata and dedicated endpointThe updated
retrieveCompeletionslogic looks sound and matches the stated objective:
- It first resolves the specific property via
getProperty, then derivesstartLinefromproperty.codedata.lineRange(adjusted viaupdateLineRangeandexpressionOffsetRef), pluslineOffset/offsetfromcalculateExpressionOffsets, giving the LS an accurate cursor position.- It switches to
getDataMapperCompletionsand enriches the context with bothcodedata: viewState.codedataand the resolvedproperty, which should let the LS specialize completions for the Data Mapper expression bar.- The existing client-side filtering and caching behavior is preserved.
Two minor robustness nits you may optionally address:
- Add a defensive check around
property.codedata?.lineRangebefore callingupdateLineRange, with a sensible fallback (e.g.,viewState.codedata.lineRange) to avoid hard failures if the server ever returns a property without line info.- Rename the local
let completions = await ...to something likelsCompletionsto avoid shadowing the state-levelcompletionsvariable and make the code easier to follow.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/index.ts(1 hunks)workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/rpc-type.ts(1 hunks)workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts(3 hunks)workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-handler.ts(2 hunks)workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts(2 hunks)workspaces/ballerina/ballerina-rpc-client/src/rpc-clients/bi-diagram/rpc-client.ts(2 hunks)workspaces/ballerina/ballerina-visualizer/src/views/BI/Forms/FormGeneratorNew/index.tsx(5 hunks)workspaces/ballerina/ballerina-visualizer/src/views/DataMapper/DataMapperView.tsx(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/index.ts
- workspaces/ballerina/ballerina-visualizer/src/views/BI/Forms/FormGeneratorNew/index.tsx
- workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-10T15:05:11.309Z
Learnt from: madushajg
Repo: wso2/vscode-extensions PR: 868
File: workspaces/bi/bi-extension/src/utils.ts:224-242
Timestamp: 2025-11-10T15:05:11.309Z
Learning: The workspaces/bi/bi-extension and workspaces/ballerina/ballerina-extension are separate VS Code extensions that are packaged and distributed independently, so they cannot share code via imports and must maintain their own implementations of common utilities.
Applied to files:
workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts
🧬 Code graph analysis (5)
workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts (1)
workspaces/ballerina/ballerina-core/src/interfaces/extended-lang-client.ts (2)
ExpressionCompletionsRequest(1088-1095)ExpressionCompletionsResponse(1112-1112)
workspaces/ballerina/ballerina-rpc-client/src/rpc-clients/bi-diagram/rpc-client.ts (4)
workspaces/ballerina/ballerina-core/src/interfaces/extended-lang-client.ts (2)
ExpressionCompletionsRequest(1088-1095)ExpressionCompletionsResponse(1112-1112)workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts (1)
getDataMapperCompletions(897-908)workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts (1)
getDataMapperCompletions(1149-1151)workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/rpc-type.ts (1)
getDataMapperCompletions(155-155)
workspaces/ballerina/ballerina-visualizer/src/views/DataMapper/DataMapperView.tsx (1)
workspaces/ballerina/ballerina-visualizer/src/utils/bi.tsx (1)
updateLineRange(538-557)
workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-handler.ts (5)
workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts (1)
getDataMapperCompletions(897-908)workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts (1)
getDataMapperCompletions(1149-1151)workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/rpc-type.ts (1)
getDataMapperCompletions(155-155)workspaces/ballerina/ballerina-rpc-client/src/rpc-clients/bi-diagram/rpc-client.ts (1)
getDataMapperCompletions(313-315)workspaces/ballerina/ballerina-core/src/interfaces/extended-lang-client.ts (1)
ExpressionCompletionsRequest(1088-1095)
workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/rpc-type.ts (4)
workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-manager.ts (1)
getDataMapperCompletions(897-908)workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts (1)
getDataMapperCompletions(1149-1151)workspaces/ballerina/ballerina-rpc-client/src/rpc-clients/bi-diagram/rpc-client.ts (1)
getDataMapperCompletions(313-315)workspaces/ballerina/ballerina-core/src/interfaces/extended-lang-client.ts (2)
ExpressionCompletionsRequest(1088-1095)ExpressionCompletionsResponse(1112-1112)
🔇 Additional comments (4)
workspaces/ballerina/ballerina-core/src/rpc-types/bi-diagram/rpc-type.ts (1)
155-155: New Data Mapper completions RPC type looks consistent
getDataMapperCompletionsmirrorsgetExpressionCompletionsin both type parameters and prefix-based method path, so the core RPC surface is coherent.workspaces/ballerina/ballerina-rpc-client/src/rpc-clients/bi-diagram/rpc-client.ts (1)
152-152: BiDiagramRpcClient plumbing for Data Mapper completions is correctThe new import and
getDataMapperCompletionsmethod are wired identically togetExpressionCompletions, delegating through the messenger with the correct RPC type and host. No functional issues spotted.Also applies to: 313-315
workspaces/ballerina/ballerina-extension/src/rpc-managers/bi-diagram/rpc-handler.ts (1)
78-78: New handler registration cleanly wires Data Mapper completionsThe added import and
messenger.onRequest(getDataMapperCompletions, ...)line correctly forwardExpressionCompletionsRequesttorpcManger.getDataMapperCompletions, parallel to the existing expression completions handler.Also applies to: 186-186
workspaces/ballerina/ballerina-extension/src/core/extended-language-client.ts (1)
357-357: Extended language client additions for Data Mapper completions are consistent
EXTENDED_APIS.BI_DATA_MAPPER_COMPLETIONSfollows the existing expression editor naming pattern and is used bygetDataMapperCompletionsexactly likeBI_EXPRESSION_COMPLETIONSis bygetExpressionCompletions.- Updating
DATA_MAPPER_PROPERTYto'dataMapper/targetFieldPosition'is fine as long as the language server exposes this new endpoint; all existing callers will transparently use the new route.- The new
getDataMapperCompletionsmethod cleanly exposes the LS API without extra behavior.No structural or typing issues detected here.
Also applies to: 373-373, 1149-1151
workspaces/ballerina/ballerina-core/src/interfaces/data-mapper.ts
Outdated
Show resolved
Hide resolved
…ode-extensions-public into b-dm-completion-impr
Purpose
Summary by CodeRabbit
Release Notes
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.