Give FCS open file contents per checker (DocumentSource) instead of the global FileSystem
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 12/100
Research direction
Start with the global shim in src/FsAutoComplete.Core/FileSystem.fs and the SharedFileSystem registry in AdaptiveServerState.fs, then trace where FSAC hands open-file text to the FCS checker. The issue sets the goal: create checkers with DocumentSource.Custom, call NotifyFileChanged on did change, did save and close, and keep only the path helpers process-wide. Done means no static server state remains, two servers in one process cannot see each other's open files, and the LSP test groups can run in parallel on shared folders.
Written by the indexing model from the issue text.
Description
Summary
FSAC gives FCS the contents and timestamps of open files through the process-wide FSharp.Compiler.IO.FileSystemAutoOpens.FileSystem. FCS also offers a per-checker way to do this, FSharpChecker.Create(documentSource = DocumentSource.Custom getSource). Moving to it would remove the last piece of shared, process-wide state between language servers in one process.
Today
Every AdaptiveState installs FSAC's FileSystem shim (src/FsAutoComplete.Core/FileSystem.fs) as the global FCS file system. The shim does three things:
OpenFileForReadShimreturns the in-memory text of open files.GetLastWriteTimeShimreturns the time an open file was last changed, which is how FCS notices edits and rechecks.IsPathRootedShim,GetFullPathShimandNormalizePathShimhandle paths in an OS-agnostic way.
Until #1554 each state wrapped the global file system around the previous one and never unwrapped it, so every state ever created stayed reachable. #1554 replaces that with a registry (SharedFileSystem in AdaptiveServerState.fs) that asks each live state for its open files, newest first, and lets a disposed state unregister. That fixes the leak, but the state is still shared: when two servers in one process have the same file open, FCS reads of one can see the text of the other. The test suite runs LSP test groups in parallel since #1554, and has to keep groups that use the same TestCases folder from overlapping for that reason. In the product there is one server per process, so it does not show there.
The alternative
DocumentSource.Custom gives each checker its own source of file text. Two things change with it (FCS main):
- FCS stamps each source file once, when the incremental builder is created, instead of asking for its last write time (IncrementalBuild.fs#L1647-L1653).
- A custom document source switches the checker to change notifications (service.fs#L215-L218), so FSAC has to call
checker.NotifyFileChanged(service.fs#L376) when an open file changes. Today the shim's last write times do this implicitly.
So the work is roughly:
- Create the checker with
DocumentSource.Custom, answering from the state's open files and falling back to disk. - Call
NotifyFileChangedwhere open files change (did change, did save, close), for the BackgroundCompiler. The TransparentCompiler already gets file versions through its snapshots; check whether it still reads through the global file system anywhere. - Keep only the path members (3.) in a process-wide shim, or drop the shim if FCS's defaults are fine there. They hold no per-server state.
- Remove
SharedFileSystem, and let the test suite run groups on the same folders in parallel.
Why
- No server state reachable from a static; the per-server file view lives with the checker.
- Servers in one process cannot read each other's open files.
- Explicit invalidation instead of timestamp comparisons on every file read.
- Dominant language
- F#
- Stars
- 489
- Forks
- 173
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 10
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from ionide/FsAutoComplete
-
Document agentic contribution workflowMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ionide/FsAutoComplete#1540 ·
Maintainers usually reply within 1 day
-
agentic-workflows automation repo-assist
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ionide/FsAutoComplete#1517 ·
Maintainers usually reply within 1 day
-
agentic-workflows automation repo-assist
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ionide/FsAutoComplete#1507 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 63/100
ionide/FsAutoComplete#1547 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
ionide/FsAutoComplete#1534 · 2 comments · 17 reactions ·
Maintainers usually reply within 1 day
All issues in ionide/FsAutoComplete
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
bug priority: P2
Difficulty 1/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
clang:static analyzer
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
llvm/llvm-project#233598 · 1 comment ·
Maintainers usually reply within 1 day
-
bug ci sev-6
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day