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
744 stars 245 forks source link

Make .snapshots folders opt-in instead of opt-out #6477

Open bjarkihall opened 3 years ago

bjarkihall commented 3 years ago

Describe the bug The AL Language extension creates empty .snapshots folders in workspace folders by default.

To Reproduce If the AL Language extension is enabled, it will create a snapshots folders in each workspace folder of a multiroot-workspace. See the screenshots section for a more detailed repro.

Expected behavior When you have no AL code you can disable extensions in your workspace, but why can't it be enabled and initialize if the active folder contains *.al files or a file called "app.json"?

Besides, if you're working with a multiroot-workspace and it contains AL code + additional code in other workspaceFolders (e.g. source code of a web-service or control-addin, mobile-app, etc.), you'll need to have the AL Language extension enabled.

You can specify the path for al.snapshotDebuggingPath and al.snapshotOutputPath and .gitignore the folders, etc. but why isn't this feature an opt-in, instead of opt-out?

The folders even get created in workspaceFolders (in multiroot-workspaces) which contain no .al files and no app.json or any reference to an AL project at all, i.e. it's just pollution.

Screenshots

A minimal repro, think of this as the root of a repository: image

If B/Repro.al is created, this error pops up: image Along with errors while trying to populate it: "The manifest file is not valid. Unable to cast object of type 'Newtonsoft.Json.Linq.JValue' to type 'Newtonsoft.Json.Linq.JObject'.AL(AL1017)". But if the file existed already and simply gets opened in the active editor, a more friendly warning is displayed: "The manifest is missing" with the optional codeaction "Generate Manifest", which unfortunately also creates the .snapshot folder in the root of the repo.

If Repro.code-workspace is opened, a snapshot folder is created in each of the workspace folders: image

If the project is bigger and contains more folders, you can imagine how noisy these empty .snapshots folders can become and I assume this might also confuse people that are setting up new projects.

The content of the .js and .al files doesn't matter. They can just be empty so it's not hard to set up and try out.

One might argue that .snapshots should always get generated in the B folder and I won't argue with that, but I think the A folder should at least be left alone.

5. Versions:

MODUSCarstenScholling commented 2 days ago

@kalberes This issue is annoying and still exists in Version 14.1.1180850 or v15.0.1177813. A workaround is to clear the setting al.snapshotOutputPath.

Please remove this feature. Thank you.