microsoft / microsoft/AL

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

Open
#6,477 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug workspaces
Dominant language
PowerShell
Stars
881
Forks
285
Avg merge
3d 36m
Merged PRs (30d)
1

Description

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:

  • AL Language:
    v6.5.413786

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with a multiroot workspace containing AL and non-AL folders, as described in the report, and observe when .snapshots folders are created. Trace the extension behavior responsible for workspace initialization; done should mean non-AL workspace folders are left untouched while AL projects still support snapshot functionality.

Written by the indexing model from the issue text.

Assessment

Tech stack
vscode
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.