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 reading file from native fs to vscode alternative #1295
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pulling out this change, I believe it's great to have the code itself ready for the transition, so that the rest is just a matter of build and testing.
I have a question about the approach though, see my comment in the diff.
let noteText = readFileSync(note.uri.toFsPath()).toString(); | ||
let noteText; | ||
|
||
vsWorkspace.fs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this will work?
I am not sure this would work, as this call returns a promise, and whether noteText
is actually set when needed (e.g. line 192
) becomes a matter of timing.
This is the reason why originally we didn't migrate this part of the code from readFileSync
.
Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not working. Need to refine it, but needed a test run on thr CI as I had some issues locally. Forgot to add wip to the PR ;)
I am not sure how we can get this working. Any ideas moving forward are welcome. This is a blocking issue to get Foam working properly on the web (#749). |
Yup, that limitation of |
This PR changes the lasst occurence of reading files natively from
fs
. This is required for using Foam on the web version of vscode, but also follows best practices.