ballerina-platform / ballerina-lang

The Ballerina Programming Language
https://ballerina.io/
Apache License 2.0
3.58k stars 738 forks source link

[Improvement]: Introduce code actions to implement resource functions of a service object type #42758

Open TharmiganK opened 4 months ago

TharmiganK commented 4 months ago

Description

$Subject

Currently we only have code actions to implement normal functions.

Describe your problem(s)

Consider the following sample:

import ballerina/http;

public type User record {|
    int id;
    string name;
    string email;
|};

public type UserNotFound record {|
    *http:NotFound;
    record {|
        int id;
        string message = "User not found";
    |} body;
|};

public type SocialMedia service object {
    *http:Service;
    resource function get users() returns User[]|error;
    resource function get users/[int id]() returns User|UserNotFound|error;

    function createInterceptors();
};

service SocialMedia on new http:Listener(8080) {

}

There is only one code action for the service declaration node: Implement createInterceptors method

Describe your solution(s)

It will be useful if we can have implementation code actions to the resource/remote methods with empty body.

Please note that, it is better if we can have a code action like implement all the methods to implement all of the methods.

Related area

-> Other Area

Related issue(s) (optional)

Required as a part of user experience with this new feature proposal: https://github.com/ballerina-platform/ballerina-library/issues/6378

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

TharmiganK commented 1 month ago

There is also required for remote functions