al-codeactions icon indicating copy to clipboard operation
al-codeactions copied to clipboard

[BUG] Creating procedure with label argument does not result in text parameter

Open PeterConijn opened this issue 7 months ago • 1 comments

Summary

When you type a non-existent procedure with a label as an argument and then use "Create Procedure", the procedure gets created with a label parameter instead of a text one.

Example

I type the non-existent procedure InitText with an argument of type Label.

local procedure CreateText()
var
    MyTextTok: Label 'My text', Locked = true;
begin
    InitText(MyTextTok); // Non-existent procedure
end;

I use AL CodeActions to create a procedure. The result is as below

local procedure InitText(MyTextTok: Label 'My text')
begin
    Error('Procedure InitText not implemented.');
end;

As you can see, the MyTextTok is transformed into an argument of type Label, which makes no sense in AL.

Expected behavior

I would expect the label to be transformed to a text parameter. If at all possible, I would expect the label suffixes (-Lbl, -Msg, -Txt, -Err, -Tok) to be removed from the parameter name.

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

PeterConijn avatar Jul 16 '24 14:07 PeterConijn