microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
728 stars 241 forks source link

Regions no longer work since Update 11 #7605

Closed Aquato closed 6 months ago

Aquato commented 8 months ago

Hello, Unfortunately, I have had the following problem since the first update to version 11. As soon as I add new code, comments or anything else, the regions stop working. You can still fold these but not where the arrow is. The screen area also looks as if everything is marked. If I remove the adjustment again, or save everything and restart Visual Studio, everything works again. Until I add or delete some lines again. So I have to work on the latest version 10 all the time. I've already tried this in a completely new file with 5 lines of code. Always the same.

Version 10:

https://github.com/microsoft/AL/assets/53939875/d54b3358-3fec-4a0a-a559-f1b79768f15b

Version 12 (As in version 11):

https://github.com/microsoft/AL/assets/53939875/e50efb75-19dd-48ca-a5df-e8048c7785a1

I was able to replicate the problem with other colleagues. However, they don't work with regions and so they hadn't noticed this before.

BazookaMusic commented 8 months ago

Can you share an example project where you see this issue so that it can be easily repro-ed?

Aquato commented 8 months ago

I tested a little further. The problem doesn't seem to occur in smaller files. I wanted to create an example for you with just a few lines. The problem didn't exist there. I looked into smaller "old" files and the problem wasn't present there either. However, the problem arises in every larger file with 1000 or more lines, and correspondingly several regions. Unfortunately I cannot send you any of these projects. The German GDPR prohibits me from doing this. I'm trying to create a sample project large enough that this problem occurs.

dannoe commented 8 months ago

The German GDPR prohibits me from doing this.

The GDPR just protects personal data of natural persons, so you can just remove or anonymize the personal information from the source code. (I would even consider this a bad practice to store personal information inside source code.) Or maybe you just meant that your company doesn't allow code sharing.

Aquato commented 8 months ago

Excuse me. Yes, I meant code sharing. I'm still working on an example project for you.

Aquato commented 8 months ago

I think I found the problem. A region within a region is probably not possible. Because that creates the problem.

The code below causes the problem as soon as you add more lines. If you remove region 2.2 the problem doesn't occur.

codeunit 99555 Test
{
    #region Test 1
    procedure Test1()
    var
    begin

    end;

    #endregion Test 1

    #region Test2
    procedure Test2()
    var
    begin
        #region Test2.2

        #endregion Test2.2
    end;
    #endregion Test2

    #region Test 3
    procedure Test3()
    var
    begin

    end;
    #endregion Test 3

    #region Test4
    procedure Test4()
    var
    begin

    end;
    #endregion Test4

    #region Test5
    procedure Test5()
    var
    begin
        //Test
    end;
    #endregion Test5

    #region Test6
    procedure Test6()
    var
    begin

    end;
    #endregion Test6
}
BazookaMusic commented 8 months ago

Thanks for the repro steps!