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
743 stars 243 forks source link

Label whose Comment contains 'MaxLength' as a placeholder identifier, causes AL0457 warning about syntax #7080

Closed dzzzb closed 2 years ago

dzzzb commented 2 years ago

This code:

codeunit 50100 Test
{
    var
        SomeLbl: Label 'having MaxLength within the text itself is OK, but...';
        MustBeBetweenErr: Label 'must be between MinLength %1 and MaxLength %2', Comment = '%1 = MinLength, %2 = MaxLength';
}

Gives this warning:

image

I guess this is a holdover from C/AL days, where maybe it was a convention to include MaxLength = 50, etc., within the comment? If so, reasonable, but is it possible to make it a bit more clever, e.g. detect if MaxLength looks like it is the identifier for a placeholder, rather than itself trying to declare something?

Ideally it would still be possible to use this as a placeholder identifier, since it's probably not an uncommon variable name :-) We can just replace with max length for now, so no big deal, but maybe you'll want to refine the diagnostic a little bit here.

Name: AL Language
Id: ms-dynamics-smb.al
Description: AL development tools for Dynamics 365 Business Central
Version: 9.0.615906
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-dynamics-smb.al
thloke commented 2 years ago

We have internally discussed this issue and have decided not to accept this issue to be fixed at the moment to prioritize other issues. Thank you for raising this concern.