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

CRS rename file does not support extension objects with individual names #305

Closed NKarolak closed 1 month ago

NKarolak commented 1 month ago

My settings are:

"CRS.ObjectNamePrefix": "AFFIX ",
"CRS.ExtensionObjectNamePattern": "<Prefix><BaseName>",
"CRS.FileNamePatternExtensions": "<ObjectNameShort>.<ObjectTypeShortPascalCase>.al",
"CRS.FileNamePattern": "<ObjectNameShort>.<ObjectTypeShortPascalCase>.al",
"CRS.RemovePrefixFromFilename": true

Previously, per app, we created only one extension object per base object, and the extension object was named after the base object: "CRS.ExtensionObjectNamePattern": "<Prefix><BaseName>",

Since runtime 13.0, we can (and should) create multiple extension object per base object The base object can even be our own app object. This requires another extension object name pattern that is not implemented yet, something like: "CRS.ExtensionObjectNamePattern": "<Prefix><BaseName><Any>",

As a result, (CRS) renaming the file for following object tableextension 50000 "AFFIX Customer 2" extends Customer will not rename the file at all (expected: Customer2.TableExt.al), but instead, it will rename the object: tableextension 50000 "AFFIX Customer" extends Customer

Even if I completely remove CRS.ExtensionObjectNamePattern, then object name "AFFIX Customer 2" will still be converted into "AFFIX Customer" - why is that?

waldo1001 commented 1 month ago

Yup, I'm going to have to tackle this.

So .. what about I'd add this "any" myself, because I wouldn't want to depend on settings from people .. but just have it work with the settings you have already ... would that make sense?

waldo1001 commented 1 month ago

Even if I completely remove CRS.ExtensionObjectNamePattern, then object name "AFFIX Customer 2" will still be converted into "AFFIX Customer" - why is that?

I'm going to assume you have the same setting on another level?

NKarolak commented 1 month ago

I'm going to assume you have the same setting on another level?

Silly me. Yes, I have the same settings also on user level, and I knew it, but for some weird reason I assumed yesterday that the levels are not considered setting by setting, but per extension (if one extension setting is defined on workspace level, don't consider any extension settings on user level).

NKarolak commented 1 month ago

So .. what about I'd add this "any" myself, because I wouldn't want to depend on settings from people .. but just have it work with the settings you have already ... would that make sense?

Sorry, I don't get the question :D

waldo1001 commented 1 month ago

basically meaning that I would add the "any" myself, meaning: in stead of going litterally <Prefix><BaseName>, I'd do something like <Prefix><BaseName>.*, and add the latter myself .. like .. anything that follows your pattern, is already ok .. if not, I'd change it into your pattern, and add nothing, resulting in possible double names.. but at least you'd be able to override it..?

NKarolak commented 1 month ago

Got it - I like that suggestion. But then you should explain this hidden implementation also here: image

waldo1001 commented 1 month ago

🫡

waldo1001 commented 1 month ago

@NKarolak , should be part of this release.

NKarolak commented 1 month ago

It's working - thanks a lot for the prompt implementation :-)