Can I write to a file with joyride? I assume i can use nbb fs package via NPM deps? (haven’t tried it yet) Or use vscode extension fs api?
You can use Node's fs lib
fs/writeFileSync I believe
Ok thanks, maybe another generic question:
Also I tried this fn, but not sure how to read promise it returns.
(vscode/workspace.fs.readDirectory ".")
(p/let [dir (vscode/workspace.fs.readDirectory ".")]
dir)
=> #<Promise[~]>Not sure how to get the value, or if I’m invoking the vscode fn correctly.
you don't get the value, you program with promises
if you print dir it will have the value, but the result of the entire expression will always be a promise, you can't escape this
Ok thanks! I’m still not getting value, but maybe I have vscode fn wrong (construct uri better?)
(p/let
[dir (vscode/workspace.fs.readDirectory "file:///Users/")]
(print dir))
=> #<Promise[~]>the expression returns a promise, but what is printed is the dir
not the return value of the expression that is printed, but the print as a side effect
then eval the expression and then eval the-dir
you should see a non-promise value in there
Will do, thanks
I got stuck on that too, a while back. I think that would be good to add to the joyride docs; I came from jvm clojure, and this was one of the stumbling blocks.
read/do the promesa tutorial