2

I currently am in an environment where my TypeScript source code lives on a remote server. I can access the code via a network share in vscode, but latency in language service features (intellisense, goto definition, etc) is slow.

Is there a way to run the TypeScript language server on my remote server and have vscode connect to it? Hoping to leverage a performance boost by language service running where the code actually lives.

bingles
  • 11,582
  • 10
  • 82
  • 93
  • not likely. ts lsp is usually spawned process from local machine and do some ipc, afaik it doesn't exposes way to configure remote ipc instead. and also, even if it's doable still there is ipc, I wouldn't expect it'd performant as similar to local. – OJ Kwon Jan 31 '18 at 19:13
  • 1
    As I understand it, the language service is a separate process that the vscode typescript extension communicates with and asks questions about the current codebase. Seems like the language server could be run on a remote server, and pipeline to communicate with it would be the only place that would have to be changed. The primary latency I'm experiencing is due to language service searching files over the network. I would expect the actual communication with the service to be much slimmer and not as impacted by the network. – bingles Jan 31 '18 at 19:27
  • 1
    you are misunderstanding concept of language service protocol to actual implementation. While it may possible underlying service protocol allow connect remotely, it is different to actual implementation allow or not. Actually it doesn't require lot of investigation, check current implementation https://github.com/Microsoft/vscode/blob/master/extensions/typescript/src/typescriptServiceClient.ts and it just tied to local process spawn. Unless you have fork your own service client / server impl to create remote connection, I doubt you can have ooto configuration for it. – OJ Kwon Jan 31 '18 at 19:42

1 Answers1

1

You can archive that implementing a TypeScript Language Service plugin that customize module resolution. There is an example here:

https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#user-content-customizing-module-resolution

The nice thing is you will only tough typescript API, and that plugin will work on any IDE that supports TypeScript Language Service. Bad thing could be that documentation is poor, this is some work I've done, basically small plugins and tutorial (I'm getting started with plugins now) https://github.com/cancerberoSgx/typescript-plugins-of-mine

cancerbero
  • 6,799
  • 1
  • 32
  • 24
  • This is interesting. I'm not seeing the connection between customizing module resolution and typescript plugins? I can only find examples of proxying methods on the language service. – bingles Nov 07 '19 at 22:19
  • Does theia using the same way you've mentioned to resolve to a remote TS LSP server? – James Yang Jul 30 '21 at 09:15