Skip to content
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

[Bug]: Code actions not working properly with resource functions #41864

Closed
SasinduDilshara opened this issue Dec 11, 2023 · 3 comments · Fixed by #42074
Closed

[Bug]: Code actions not working properly with resource functions #41864

SasinduDilshara opened this issue Dec 11, 2023 · 3 comments · Fixed by #42074
Assignees
Labels
Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Bug userCategory/Compilation
Milestone

Comments

@SasinduDilshara
Copy link
Contributor

Description

import ballerina/http;

type Customer record {|
    string id;
    string name;
    string address;
|};

table<Customer> key(id) customers = table [
    { id: "C-123", name: "John", address: "123 Main St." },
    { id: "C-223", name: "Jane", address: "456 Main St." },
    { id: "C-173", name: "Joe", address: "789 Main St." }
];

service /customers on new http:Listener(0) {
    resource function get customers/[string id]() {
        return <CURSOR>customers[id] ?: <http:NotFound>{
            body: string `Customer not found. Customer ID: ${id}`
        };
    }
}

In the above cursor position, the program does not give the correct code action to update the return type of the resource function.

Steps to Reproduce

No response

Affected Version(s)

No response

OS, DB, other environment details and versions

No response

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@SasinduDilshara SasinduDilshara changed the title [Bug]: Code actions not working properly with resources [Bug]: Code actions not working properly with resource functions Dec 11, 2023
@SasinduDilshara SasinduDilshara added the Team/LanguageServer Language Server Implementation related issues. #Compiler label Dec 11, 2023
@ballerina-bot ballerina-bot added needTriage The issue has to be inspected and labeled manually userCategory/Compilation labels Dec 11, 2023
@SasinduDilshara SasinduDilshara removed the needTriage The issue has to be inspected and labeled manually label Dec 11, 2023
@nipunayf nipunayf self-assigned this Jan 18, 2024
@KavinduZoysa KavinduZoysa moved this to In Progress in Ballerina Team Main Board Jan 18, 2024
@LakshanWeerasinghe
Copy link
Contributor

The change return type code action is not working for both ternary-conditional-expression and nil-conditional-expression.

return customers[id] is () ? "jo" : <http:NotFound>{
            body: string `Customer not found. Customer ID: ${id}`
        };

@nipunayf
Copy link
Contributor

nipunayf commented Jan 19, 2024

The issue is blocked #42009 as the provided return type by the semantic model is invalid.

Copy link

github-actions bot commented Feb 5, 2024

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

@nipunayf nipunayf added the Reason/EngineeringMistake The issue occurred due to a mistake made in the past. label Feb 5, 2024
@nipunayf nipunayf added this to the 2201.9.0 milestone Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Bug userCategory/Compilation
Projects
Archived in project
4 participants