AL languages internal cache is not always correctly refreshed
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 881
- Forks
- 285
- Avg merge
- 3d 36m
- Merged PRs (30d)
- 1
Description
1. Describe the bug
The AL language editor host executable has an internal cache where it holds things like referenced symbols and project symbols and so on. I assume for performance reasons. This cache however is not always refreshed correctly and requires the user to run a "Reload Window" or reload the entire project workspace to refresh it.
I have a few scenarios where this happens and is a problem for me:
- When I externally download symbols they are not detected by AL language.
- Modifying the
app.jsontriggers a cache refresh, but only when done so from inside VS Code. Ifapp.jsonis modified externally, AL language does not detect a change to it and thus does not refresh anything. - Switching branches in git causes the cache of the AL language to become stale. The symbols in it's cache still refer to the old version of my objects. This until I either reload the project (as described above) or I open the object in question. This however refreshes the cache for this object only.
2. To Reproduce
Steps to reproduce the behavior:
Scenario 1:
- Download a symbol package manually from somewhere and place it in the
.alpackagesfolder. - The new symbol package is not detected.
Scenario 2:
- Use a project with a dependency to an app that you already have in your
.alpackagesfolder. - Update the minimum version to something higher that is not available.
- You correctly get an error stating that symbols are missing.
- Externally modify
app.jsonand reset the version to what it was before. - The symbol is still missing according to AL language.
Scenario 3:
- Work on a feature branch where you removed a method from an object.
- Close the editor for that object.
- Switch back to a different branch where the method from 1 still exists.
- Go to a different object and reference this method.
- AL language argues that this method does not exist, but it does.
3. Expected behavior
Option 1: detect file changes even when made from outside the project. There are numerous tools around now that interface with AL projects, tying it's caching mechanism to only what happens under AL languages watch is very limiting. You could, for example, bind this to the app.json file only. Anyone who wants to cause a cache refresh from outside VS Code then just has to touch that file and you would not have to watch all project files for changes.
Option 2: give us a command that let's us explicitly cause a cache refresh without having to reload the entire editor. This command would then also be required to be callable from other extensions, pretty please.
4. Actual behavior
The cache often becomes stale and requires me to reload my editor, causing lots of reload times.
5. Versions:
- AL Language: 15.0.1177813
- Visual Studio Code: 1.95.1
- Business Central: n/a
- Operating System:
- Windows
- Linux
- MacOS
Internal work item: AB#556873
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the AL language extension observes changes to .alpackages and app.json, including external edits and git branch switches. Reproduce the three scenarios, then verify that symbol and project caches refresh without a full VS Code window or workspace reload, either through file detection or an explicit refresh command.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100