1

I'm running a remote language server on with vscode via an extension I'm developping. Both client and server have access to the code via a mounted shared folder. The issue is that this folder is located on different places on the client and on the server. (/home/username/myproject on the client, /mnt/shared_folder/myproject on the server)

My question is can I configure the vscode language client so that it translates the path from the local location to the remote location and vice-versa?

If I'm running the language client from a project with a workspace, can I configure it so that it send file URI relative to the workspace root rather than sending the absolute file path? Doing so I can simply reconstruct the file uri on the server side with the path of the shared folder mount point.

I heard of Middlewares or uriConverters but I'm not sure if this the purpose they are intended to be used for.

Thank you!

1 Answers1

0

It's expected by the Language Server Protocol that the URIs to reference files are the same on both server and client side. I think the best is to place on the server (which after all is the one that has the "clone" of the files and not the orginal ones) the logic to turn the client URIs "/home/username/myproject" into server URIs "/mnt/shared_folder/myproject" when trying to access the files. Accessing the file is part of your implementation, so it's not something that's part of the LSP API, and conversion should happen inside your implementation.

Mickael
  • 3,506
  • 1
  • 21
  • 33