ballerina-lang icon indicating copy to clipboard operation
ballerina-lang copied to clipboard

Introduce create method code action

Open gayalkuruppu opened this issue 2 years ago • 0 comments

Description

Currently we do not provide a code action for creating a method. Diagnostic - undefined method 'print' in object 'Person'(BCE2013)

Describe your problem(s)

Scenario 1:

class Person {
    private int age = 0;

    public function getAge() returns int {
        return self.age;
    }

    public function setAge(int age) {
        self.age = age;
        self.print(age);
    }
}

Scenario 2:

public class Counter {
    private int n;

    public function init(int n) {
        self.n = n;
    }
}

public function main () {
   Counter obj = new (0);
   obj.getSome();
}

Scenario 3: Creating the method In another file.

Describe your solution(s)

Create a method inside the class (or inside the object-constructor-expr for that usecase)

Related area

-> Editor

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

gayalkuruppu avatar Sep 22 '22 05:09 gayalkuruppu