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

Use quotes around field names that start with an integer #293

Closed zeande closed 9 months ago

zeande commented 9 months ago

In AL Code, it is required that any field name starting with an integer is wrapped in double quotes. If not, then the compiler throws a huge fit.

When saving a file, the CRS language extension currently removes quotes from these field names, resulting in uncompilable code. Even if using ">Save without formatting", the CRS extension still removes the quotes. This problem is described in #153

This fix changes the StringFunctions.encloseInQuotesIfNecessary method to also recognize such field names and enclose them in quotation marks.

waldo1001 commented 9 months ago

Thanks for this pullrequest. would you see it possible to foresee a unit test?

zeande commented 9 months ago

Thanks for this pullrequest. would you see it possible to foresee a unit test?

Sorry, was a bit apprehensive, since I'm not familiar with the language. The latest commit contains some unit tests for the change.

zeande commented 9 months ago

@waldo1001 - unit tests added. If you are OK with the proposed changes, this PR would be ready to merge.

Local test result output:

image

image

waldo1001 commented 9 months ago

Thanks so much! 🙏

sschuh commented 9 months ago

Please revert this change, this causes some other side effects. I ask my colleagues for details. More infos will be coming soon.

sschuh commented 9 months ago

Here it is: tnavguy - 1729226412325032325

zeande commented 9 months ago

Here it is:

295 addresses this issue