DavidFeldhoff / al-codeactions

MIT License
17 stars 8 forks source link

Create Procedure: Missing Boolean return value #65

Closed NKarolak closed 4 years ago

NKarolak commented 4 years ago

In a test codeunit, create the following procedure:

    local procedure AssertMyFunction_True(MyText: Text)
    var
        Assert: Codeunit Assert;
    begin
        Assert.IsTrue(MyFunction(MyText), '');
    end;

Run the quick fix on MyFunction. Actual result:

    local procedure MyFunction(MyText: Text)
    begin
        Error('Procedure MyFunction not implemented.');
    end;

Expected result:

    local procedure MyFunction(MyText: Text) : Boolean
    begin
        Error('Procedure MyFunction not implemented.');
    end;
DavidFeldhoff commented 4 years ago

Hi Natalie, I could reproduce that, even if it should work. I'll look at it. Furthermore it looks like the indentation is wrong (compared to the indent of Assert.IsTrue)? I'm asking because I couldn't reproduce that.

NKarolak commented 4 years ago

Thanks David :)

I think the indentation was fine; it just was not copied correctly to GitHub. Just mind the content, not the format ;-)

DavidFeldhoff commented 4 years ago

Okay, thanks for clarifying :)

DavidFeldhoff commented 4 years ago

Okay, I found the problem and fixed it. It's already working if it's a parameter of a procedure inside the same object, but if it's in another object - like in this case in the Assert-Codeunit - then it failed finding the return type. As I plan to make further improvements to my extension the next week I'll publish it together with these planned changes. Hope you can wait a few days for that :)

NKarolak commented 4 years ago

Sure, thanks :)

NKarolak commented 4 years ago

Working, thank you :-)