waldo1001 / crs-al-language-extension

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

ReportExtension prefixes not working in columns when ObjectNamePrefix contains a space #263

Open deerware opened 1 year ago

deerware commented 1 year ago

Hi,

Our ObjectNamePrefix contains a space, because we need to distinguish our global and customer projects, our current settings are:

"CRS.ObjectNamePrefix": "ART CU ",
"CRS.OnSaveAlFileAction": "Rename",

A problem unfortunately comes with ReportExtensions, it does not format correctly when it comes to spaces.

column(ART_CU_Quote_SalesHeaderCaption; QuoteLbl) { }

becomes

column("ARTCU ART_CU_Quote_SalesHeaderCaption"; QuoteLbl) { }

I could understand that, but even if we were to use the ARTCU instead of ART_CU, it still doesn't work because it doesn't recognize it's own formatting and just loops around, and the name is changed with each save, like so:

// After 2nd save
column(ARTCUART_CU_Quote_SalesHeaderCaption; QuoteLbl) { }

// After 3rd save
column("ARTCU ARTCUART_CU_Quote_SalesHeaderCaption"; QuoteLbl) { }

// After 4th save
column(ARTCUARTCUART_CU_Quote_SalesHeaderCaption; QuoteLbl) { }

// After 5th save
column("ARTCU ARTCUARTCUART_CU_Quote_SalesHeaderCaption"; QuoteLbl) { }

// And so on..

I would propose that multiple accepted prefixes could be set, with the default being the first one, or, better yet, just don't do anything if the prefix meets the requirements of AppSourceCop.json

"mandatoryAffixes": [
    "ART CU ",
    "ART_CU_"
],
deerware commented 1 year ago

Edit: When I changed the settings

- "CRS.ObjectNamePrefix": "ART CU ",
+ "CRS.ObjectNamePrefix": "ART CU",

It does not loop around and just keeps the same, but I still think this issue should be addressed

TKapitan commented 1 year ago

It's related to this AL issue: https://github.com/microsoft/AL/issues/7057

pri-kise commented 1 year ago

@deerware I tried to fix this in the open pull request (https://github.com/waldo1001/crs-al-language-extension/pull/254)

Now the AppSourceCop. json would be used for reportextensions and tableextensions. I'm still waiting for some feedback on my pull reuqest, but eventually we will get this solved.

AbsolutelyFreeWeb commented 1 year ago

It's also related to this, dashes are also giving errors: #272

pri-kise commented 1 year ago

@deerware have you tried out the new option to provide multiple affixes in the appsourcecop.json

deerware commented 1 year ago

@pri-kise I have just tried it. It seems to be working fine now.

Testing process:

The looping around is a separate issue which can simply be fixed the user. The main issue is fixed.

Thank you for the fix.