Skip to content

[2201.12.x] Include only the type name in the Type object for visibleVariableTypes API variable types #877

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

LakshanWeerasinghe
Copy link
Contributor

Purpose

$subject

Fixes OOM occurs when trying to return a value using BI

The visibleVariableTypes API is used in the expression editor's helper pane, where we display visible variable symbols grouped under different categories. Currently, this helper pane only uses the Type object to show the type name alongside each variable.

However, the existing implementation of the Type object includes additional type information, which is unnecessary for this use case and can lead to performance issues, as noted in this comment.

With this PR, we simplify the response by including only the type name in the Type object associated with each variable.

Screen.Recording.2025-05-21.at.14.43.39.mov

@NipunaRanasinghe NipunaRanasinghe requested a review from Copilot May 22, 2025 09:42
Copy link
Contributor

@Copilot Copilot AI left a 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 streamlines the visibleVariableTypes API response by including only the variable’s type name and signature, improving performance and removing unnecessary type details.

  • Updated JSON fixtures to drop deep type info (fields, restType, typeInfo) and add a simple "name" alongside "typeName".
  • Modified VisibleVariableTypesGenerator to use a new fromTypeSymbol helper that sets only typeName and name.
  • Added type-symbol imports and helper methods; replaced old Type.fromSemanticSymbol calls.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

File Description
modules/flow-model-generator-ls-extension/src/test/resources/visible_variable_types/config/*.json Removed complex type structures and added "name" fields
modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/VisibleVariableTypesGenerator.java Introduced fromTypeSymbol/getTypeName helpers and updated imports
Comments suppressed due to low confidence (1)

flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/VisibleVariableTypesGenerator.java:31

  • The Qualifier import is no longer used in this file. Consider removing it to clean up unused dependencies.
import io.ballerina.compiler.api.symbols.Qualifier;

@LakshanWeerasinghe LakshanWeerasinghe merged commit 8a45a3b into ballerina-platform:2201.12.x May 23, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant