DavidFeldhoff / al-codeactions

MIT License
17 stars 8 forks source link

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

Open PeterConijn opened 1 month ago

PeterConijn commented 1 month ago

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;