waldo1001 / crs-al-language-extension

Make working with the (Dynamics NAV / 365) AL Language easier and more efficient.
MIT License
34 stars 43 forks source link

File Name patterns for new BC versions #141

Closed ernestasjuska closed 4 years ago

ernestasjuska commented 5 years ago

Hi,

New code analysers from AL Language extension shows warning if file is not named correctly. E.g: table 123 "PREFIX My Demo" should be in file PREFIXMyDemo.Table.al, and page extension 1234 "PREFIX My Demo Ext" extends "Standard Page" should be in file PREFIXMyDemoExt.PageExt.al.

My initial guess was to use this:

        "CRS.FileNamePattern": "<ObjectNameShort>.<ObjectType>.al",
        "CRS.FileNamePatternExtensions": "<ObjectNameShort>.<ObjectType>.al",
        "CRS.FileNamePatternPageCustomizations": "<ObjectNameShort>.PageCust.al"

This does not correctly capitalize object type (e.g. gives "codeunit" intead "Codeunit"), and does not give shorter extension object type (e.g. gives "pageextension" instead "PageExt").

I'm using AL Language extension 5.0.191295 (that's from insider BC version).

IMHO all that is missing is <ObjectTypeShortPascalCase> that would give "Table", "Page", "Codeunit", "Report", "Query", "XmlPort", "Enum", "TableExt", "PageExt", "EnumExt", "PageCust".

Analyser does not consider case however it PascalCase looks nicer.

Thanks.

image

waldo1001 commented 5 years ago

So .. they made a rule to force a fixed naming behaviour :-/. Not sure I like that :(.

Thanks for the headsup - I guess I'll need to solve this by the time they release it.. .

hmerbouche commented 5 years ago

Hello, It seems that the new naming rule of microsoft does not include the affix in the file name! The new naming: "ObjectNameExcludingPrefix.FullTypeName.al' 'ObjectNameExcludingPrefix.FullTypeNameExt.al'

Thanks

waldo1001 commented 5 years ago

Well, I have an issue with this ... . If I change anything on the "auto renaming" part, I will start creating new names all of a sudden in existing environments - without people expecting it .. :-/.

Don't know what I should do, to be honest :(.

waldo1001 commented 5 years ago

@ernestasjuska , @hmerbouche ,

I decided to add a seperate tag as suggested ... . As I don't have a complete overview - do you think this is conclusive - not sure about the controladdin :-/ - and no way I can look it up ... ?

            case 'page': return 'Page';
            case 'pageextension': return 'PageExt';
            case 'codeunit': return 'Codeunit';
            case 'table': return 'Table';
            case 'tableextension': return 'TableExt';
            case 'xmlport': return 'XmlPort';
            case 'report': return 'Report';
            case 'query': return 'Query';
            case 'profile': return 'Profile';
            case 'pagecustomization': return 'PageCust';
            case 'enum': return 'Enum';
            case 'enumextension': return 'EnumExt';
            case 'controladdin': return 'ConAddin';
waldo1001 commented 5 years ago

@ernestasjuska @hmerbouche ,

if you'd like to test it - here's a pre-build: https://www.dropbox.com/s/7vvkwit4t9qujw9/crs-al-language-extension-1.1.20.vsix?dl=1

waldo1001 commented 5 years ago

I think these settings should work as "Best Practice", which make you able to use a prefix (or suffix), not add it in the filename, and the pascalcasing is there ... .

    "CRS.OnSaveAlFileAction": "Rename",
    "CRS.FileNamePattern": "<ObjectNameShort>.<ObjectTypeShortPascalCase>.al",
    "CRS.FileNamePatternExtensions": "<ObjectNameShort>.<ObjectTypeShortPascalCase>.al",
    "CRS.FileNamePatternPageCustomizations": "<ObjectNameShort>.<ObjectTypeShortPascalCase>.al",
    "CRS.ObjectNamePrefix": "ALDA ",
    "CRS.RemovePrefixFromFilename": true,
hmerbouche commented 5 years ago

@waldo1001

I tested the new vsix and the new setting, it seems just perfect! Do you know when you can release this new version? Thanks

hmerbouche commented 5 years ago

@waldo1001 To complete / correct your list :) Object | Abbreviation

Request Page | RequestPage Control Add-ins | ControlAddin Dotnet | Dotnet

ernestasjuska commented 5 years ago

@waldo1001

Thanks. It works great.

Tested control add-ins naming: For controladdins it should return "ControlAddIn" with capital "I". image

Found one more type: interface "LBC My Interface" { } should be in file LBCMyInterface.Interface.al. image

waldo1001 commented 5 years ago

Pretty soon ;-)

DanielGoehler commented 4 years ago

@waldo1001 Do you like to change ConAddin to ControlAddin like the Suggestion from Microsoft?

mjmatthiesen commented 4 years ago

Forced naming standard :( That would be the worst. The current standard isn't very readable. Gimme my spaces.