ballerina-lang
ballerina-lang copied to clipboard
[Improvement]: Test connection code lens
Description
Can we get a code lens to test the db connection. Like run.
Describe your problem(s)
No response
Describe your solution(s)
No response
Related area
-> Compilation
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response
@shafreenAnfar, Just to clarify more, Do you suggest the code lens once the db is defined or when db is used?
The functionality is similar to how IntelliJ tests the database connection with the Test Connection button after capturing user's parameters.
For each such connector initialization, VS Code should provide a Test code lens on top of the statement to execute this functionality. There are several concerns associated with the implementation of the code lens.
- There can be variables defined previously that are relevant to the connector initialization. Since there are two types, there is a specific approach to handle each such case.
- We can prompt a form (requiring a new UI for this) for the runtime variables. The language server can determine properties required to represent variable input based on the type and function signature.
- Otherwise, if it is a constant, we can use that value since it is available at compile-time. Still, the form can be provided with the constant value filled in as a default value.
- There can be different types of connectors and different ways to check the connection for each. Therefore, we have to consider how we can scale the respective code lens to each case. Ideally, the LS should provide a framework to support this code lens, and the respective library should provide the implementation of how to test the connection.