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

Change all fs usage to be asynchronous #1986

Closed
bjaspan opened this issue Nov 1, 2023 · 1 comment
Closed

Change all fs usage to be asynchronous #1986

bjaspan opened this issue Nov 1, 2023 · 1 comment
Assignees

Comments

@bjaspan
Copy link
Contributor

bjaspan commented Nov 1, 2023

LanguageDefinition.ts uses readFileSync and existsSync from fs. The VSCode FS API for web extensions does not provide synchronous function calls: https://code.visualstudio.com/api/references/vscode-api#FileSystem. As far as I can tell from a little reading, it is not possible to implement a synchronous function out of an asynchronous function in typescript. Any function that wants to await on an asynchronous function return value must itself be async. So I think to support a web version of Cursorless we need to refactor LanguageDefinition, and all other uses of synchronous FS methods, into asynchronous code.

@AndreasArvidsson
Copy link
Member

The vscode implementation of file system have now moved to be a synchronous. As far as I can tell all async implementations of fs are in scripts, test harness or the webpage.

await vscode.workspace.fs.readFile(this.resolveBundledPath(path)),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants