AL icon indicating copy to clipboard operation
AL copied to clipboard

F2 popup exceeding the parameter name

Open NKarolak opened this issue 4 years ago • 5 comments

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;
  1. Click somewhere on parameter name SalesDocType and press F2: The popup contains only SalesDocType, as expected.
  2. Click somewhere on parameter name DINo and press F2: The popup contains only DINo, as expected.
  3. Click somewhere on parameter name SalesLine and press F2: The popup contains "; DINo: Code[23]; SalesLine: Record " image

Expected behavior At 3., the popup should contain SalesLine only.

5. Versions:

  • AL Language: 5.0.312966
  • Business Central: 16.0

NKarolak avatar Aug 14 '20 10:08 NKarolak

The bug still exists in AL 6.1.397164

NKarolak avatar Feb 01 '21 13:02 NKarolak

Workaround: temporarily add a line break directly before the parameter to rename. image

NKarolak avatar Oct 20 '21 05:10 NKarolak

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. image

  • anywhere on Spagh - works as expected. image

  • after e and after the first t - 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... image

  • after second t and after i - works as expected. image

  • after : and before " - bug. I think F2 should do nothing in this case. image

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 : image

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.

ernestasjuska avatar Feb 21 '22 16:02 ernestasjuska

@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.

image

DanielGoehler avatar Dec 16 '22 22:12 DanielGoehler

@kalberes Could Microsoft please prioritize this bug?

NKarolak avatar Dec 17 '22 07:12 NKarolak