al-code-outline icon indicating copy to clipboard operation
al-code-outline copied to clipboard

Sort procedures, Sort permissions, ... fails when the #pragma warning directive is used in the code

Open rvanbekkum opened this issue 3 years ago • 3 comments

Hi @anzwdev, Something me and my colleague noticed. The sorting commands do not work if #pragma warning ... is used in the code. If you comment out or remove the lines, then the sorting commands work again.

rvanbekkum avatar Jan 10 '22 14:01 rvanbekkum

Hi @rvanbekkum

Yes, I designed it this way. If there are no directives inside sorted area of code (i.e. between variable declarations inside var section), whole section of code will be sorted. If there are #region and #endregion directives, syntax nodes inside these regions will be sorted separately. If there are any other directives, sorting is currently disabled to avoid situation when directive covers different lines of code than before running the command.

anzwdev avatar Jan 13 '22 23:01 anzwdev

Hi @anzwdev, I fully understand your motive but unfortunelately the result is really undesirable. Sorting won't work anymore for all objects where #pragma directives are used. An additional setting like "Ignore #pragma directives on sorting" would really help me/us!

passion4dev avatar Oct 11 '22 11:10 passion4dev

It is quite common in our AppSource apps that we have one or more objects that is obsoleted, and still have those in our Permission Sets we are adding pragmas for AL0432 around that object - and this is killing the sort permissions feature for all our AppSource apps. :(

Maybe it's possible to solve that particular use case?

jwikman avatar Jan 04 '23 10:01 jwikman