Closed probablycorey closed 5 years ago
Thanks for the report, @probablycorey. We inspected the linked gist and you are calling tree.getText
with a file id as opposed to a buffer id. It would actually be a type error if you were using TypeScript in your example.
The right way of using that API is to first call openTextFile(fileId, baseText)
and that will return a buffer id that you can then pass to getText
:
const bufferId = tree.openTextFile(fileId, "");
console.log(tree.getText(bufferId));
Closing this, but happy to keep discussing it.
Doh, my bad. Thanks @as-cii, I double checked the actual code that is causing problems and realized that it is because I'm sending the path instead of the name to rename
. 🤦♂️
Example code showing the as at https://gist.github.com/probablycorey/3a673dd08aea886ec3785161d646e46e.
I can add a file to a subdirectory (and I can verify that it worked by calling
tree.entries()
) but when I callgetText
using the new fileId I get this error.