Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project fileModified events can be emitted before file: protocol supporter is registered #1606

Open
misode opened this issue Sep 27, 2024 · 0 comments
Labels
🐛 bug Something isn't working /core
Milestone

Comments

@misode
Copy link
Member

misode commented Sep 27, 2024

During project#ready, the listDependencyFiles and listProjectFiles tasks are started in parallel. However a problem occurs when listProjectFiles finished before listDependencyFiles, and the watcher notices a file has been modified. Since this.#watcherReady has been set to true it will emit a fileModified event, which will try to read the file. This in turn will try to find the file: uri protocol, but that is only registered at the end of listDependencyFiles, and it is possible that hasn't finished yet.

[Project] [read] Failed creating TextDocument for file:///<workspace>/spyglass.json Error: The protocol “file:” is unsupported.
    at FileServiceImpl.getSupportedProtocol (c:\<extension>\packages\core\src\service\FileService.ts:102:10)
    at FileServiceImpl.readFile (c:\<extension>\packages\core\src\service\FileService.ts:119:25)
    at createTextDocument (c:\<extension>\packages\core\src\service\Project.ts:713:50)
    at getCacheHandlingPromise (c:\<extension>\packages\core\src\service\Project.ts:741:21)
    at _Project.read (c:\<extension>\packages\core\src\service\Project.ts:772:10)
    at _Project.ensureBindingStarted (c:\<extension>\packages\core\src\service\Project.ts:882:26)
    at EventEmitter.<anonymous> (c:\<extension>\packages\core\src\service\Project.ts:378:16)
    at EventEmitter.emit (node:events:531:35)
    at _Project.emit (c:\<extension>\packages\core\src\service\Project.ts:285:29)
    at ChokidarWatcherWrapper.<anonymous> (c:\<extension>\packages\core\src\service\Project.ts:562:12)
@misode misode added 🐛 bug Something isn't working /core labels Sep 27, 2024
@misode misode added this to the Backlog milestone Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working /core
Projects
None yet
Development

No branches or pull requests

1 participant