AL
AL copied to clipboard
F2 popup exceeding the parameter name
Describe the bug Under certain circumstances, F2 on a parameter name will generate a popup that will contain more than the mere parameter name.
To Reproduce Create the following procedure:
local procedure MyProcedure(SalesDocType: Enum "Sales Document Type"; DINo: Code[23]; SalesLine: Record "Sales Line")
begin
end;
- Click somewhere on parameter name
SalesDocType
and press F2: The popup contains onlySalesDocType
, as expected. - Click somewhere on parameter name
DINo
and press F2: The popup contains onlyDINo
, as expected. - Click somewhere on parameter name
SalesLine
and press F2: The popup contains"; DINo: Code[23]; SalesLine: Record "
Expected behavior
At 3., the popup should contain SalesLine
only.
5. Versions:
- AL Language: 5.0.312966
- Business Central: 16.0
The bug still exists in AL 6.1.397164
Workaround: temporarily add a line break directly before the parameter to rename.
Hi.
The bug is still in here in 2022. I have tried to make this reproducible without referring to other apps.
Example code:
codeunit 50100 "WordWordWordWord Word"
{
}
codeunit 50101 "Smth"
{
}
codeunit 50102 "My Demo"
{
procedure MyDemo(MyDemo: Codeunit "WordWordWordWord Word"; Spaghetti: Codeunit "Smth")
begin
end;
}
Results for rename (F2) on Spaghetti
depending on where you put the cursor:
-
after
;
- bug. I think F2 should do nothing in this case. -
anywhere on
Spagh
- works as expected. -
after
e
and after the firstt
- bug. Note that it starts and ends with double quote. My guess is that rename function just looks for double quote before it and double quote after it but that does not consider that previous double quote can be a closing double quote (except it is not that simple - see below). IMO it should use results from static analysis instead - the rename itself works properly in the end.And what makes those two characters special? No idea...
-
after second
t
and afteri
- works as expected. -
after
:
and before"
- bug. I think F2 should do nothing in this case.
The interesting thing is that removing double quotes around Smth
makes rename show correct text.
But if you add anything with double quotes after it it will break and the place is exactly the same as before - after e
and after the first t
:
Another thing I noticed is that the position where rename breaks only depends on position on the double quote before. So adding space after "WordWordWordWord Word"
makes rename fail one character earlier (after h
and e
but no longer after the first t
).
Oh, and also that
in "WordWordWordWord Word"
is important. If you remove that space it makes F2 take correct text as long as cursor is on top of the identifier.
Please fix. Thanks.
@atoader That is annoying. Super fast repo for you: https://github.com/StefanMaron/MSDyn365BC.Code.History/blob/master/shopify/app/Shopify%20Connector/src/Products/Codeunits/ShpfyCreateItem.Codeunit.al#L194
F2 on ItemVariant triggers this bug. Can you put in a good on you dev colleagues so that this is fixed.

@kalberes Could Microsoft please prioritize this bug?