You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently writing a LanguageService plugin.
I need read access to the file system and probably a bit of file watching in this plugin. I don't want to use Node's fs module directly to allow execution in other environments.
So I looked for existing abstractions to do FileSystem IO. Here's what I found out so far:
PluginCreateInfo.serverHost: the host of all hosts, accesses the file system directly PluginCreateInfo.project: uses a CachedDirectoryStructureHost to allow file system reads, doesn't support watching PluginCreateInfo.languageServiceHost: the same as PluginCreateInfo.project in the default implementation? with a lot of optional methods so not really pleasant to use
When using ServerHost for file watching I need to clean up after myself when my plugin is disposed?
Are the assumptions above correct? Is there some kind of documentation how this all works together (other than looking at the code)?
The text was updated successfully, but these errors were encountered:
I dont know if there is documentation around it but ts.sys is our FS abstraction. Other hosts like language service or project arent file system implementers. Eg. Project implements languageServiceHost so it doesn't need watch implementation. it internally does watch depending on what kind of languageServiceHost commands take place. (eg. from program watching missing files etc)
Thank you for the insights. I think I'll try to avoid ts.sys as the ServerHost might use a different means for filesystem access.
My current approach is using Project where possible and falling back to ServerHost for watching.
I'm currently writing a LanguageService plugin.
I need read access to the file system and probably a bit of file watching in this plugin. I don't want to use Node's
fs
module directly to allow execution in other environments.So I looked for existing abstractions to do FileSystem IO. Here's what I found out so far:
PluginCreateInfo.serverHost
: the host of all hosts, accesses the file system directlyPluginCreateInfo.project
: uses a CachedDirectoryStructureHost to allow file system reads, doesn't support watchingPluginCreateInfo.languageServiceHost
: the same asPluginCreateInfo.project
in the default implementation? with a lot of optional methods so not really pleasant to useWhen using
ServerHost
for file watching I need to clean up after myself when my plugin is disposed?Are the assumptions above correct? Is there some kind of documentation how this all works together (other than looking at the code)?
The text was updated successfully, but these errors were encountered: