Search code examples
visual-studio-codevscode-remote

How does VS Code handle file synchronization in a remote container?


I'm using VS Code Remote Container and I usually attach to an existing container in Kuberentes. I can edit files remotely but I'm not sure how VS Code caches the remote files/folders? Does it create any additional files or volumes locally in order to keep the cached folders?


Solution

  • VS Code handle remotes features with the VS Code Server. This is a Microsoft binary that interact with your local VS Code through an exposed port:

    VS Code Interactions From: https://code.visualstudio.com/docs/remote/containers

    That's why when you're peering for the first time your VS Code with your K8S container, VS Code install VS Code Server binary inside your container, wich open a specific port for the VS Code full-feature communication with your client. I was not able to find any source for the server, however you can reverse-engineering this process to get the binary server: https://stackoverflow.com/a/57601121/9414882