microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
722 stars 242 forks source link

F2 popup exceeding the parameter name #6080

Open NKarolak opened 3 years ago

NKarolak commented 3 years ago

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:

NKarolak commented 3 years ago

The bug still exists in AL 6.1.397164

NKarolak commented 2 years ago

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

ernestasjuska commented 2 years ago

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:

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.

DanielGoehler commented 1 year ago

@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
NKarolak commented 1 year ago

@kalberes Could Microsoft please prioritize this bug?