Creating/Writing a file to the current workspace directory

Hi,
I am relatively new with Theia, I’m currently making my first own extension that takes a file and processes it. The processing results in typescript interfaces, which I would want to write to a file in the current workspace the user is in Theia. Now it is writing it to the directory that runs Theia in the backend.

I’m not sure what the best practice for this is, do I need to use JSON RPC to communicate the URI of the current workspace or is it possible to do it more efficiently?

@loba welcome to the community and thank you for the discussion!

You can likely use the WorkspaceService to know about the current workspace (or multi-root workspace), and use the FileService to actually perform filesystem operations.

I do not believe that JSON RPC is necessary for this use-case.

Thanks for the reply, I will try those out!

1 Like