Replies: 5 comments 9 replies
-
|
Just to report a bit about my experience. 🎈 I like VSCode to not connect to my Docker containersFor me, it's just my limited time and laziness that make me favor still running VSCode completely separate from my Docker containers. See more details for this rationale
Furthermore, I like browsing through my code and linting it, without having to start up Docker Desktop first. I usually modify and add some code here and there, then realize it'd be nice to interact with the app now, e.g. browse the UI or debug something. That's when I startup Docker Desktop in the background and launch a simple 🎈 I still need some processes to run inside the main app Docker containerBut everything comes with advantages & disadvantages. In this case, well... we cannot use (without added effort) any IDE feature that needs our app's runtime:
So apart from running tests being a bit hacky, I'm fine with the setup; it has proven to work well during the last year. We even run Cypress tests inside a Docker container and forward the UI in WSL 😅 (where WSL nowadays is automatically WSLg, so X11 works out of the box). 🎈 So what?Unfortunately, I don't know how to really derive helpful ideas to improve container support of VSCode / Ruby LSP. Here, you proposed the "socket solution" (see also #1782):
Yes, this could improve our setup (for usage of "server dependent features" and running tests). However, I would then be in a situation where I'd have to start Docker Desktop to get any linting in my IDE, which I would really dislike. For my purpose, a hooking mechanism in Ruby LSP would be great, such that we could get rid of the Ruby Test Explorer extension (which doesn't yet support the native VSCode Test Explorer UI, see here, and which seems a bit abandoned). Such a hook could allow me to execute a custom script that executes the test inside a docker container however I like, then reports the results back. As inspiration, for reporting, the Test extension uses a |
Beta Was this translation helpful? Give feedback.
-
Could you please tell a bit more about "other shell commands we try to run"? A test running command can be customized in a
Currently, you can solve this by organizing a project's files such as they have the same paths locally and in a container (I'm using the I don't think Ruby LSP must explicitly deal with containerization. Just give the user more flexibility (like a custom server run path and custom anything else we need). Call it "experimental", so unexperienced users do not touch it accidentally. |
Beta Was this translation helpful? Give feedback.
-
|
I'd love to see better general support for running Ruby LSP in a containerized environment outside of VSCode and devcontainers. I'm using Neovim and usually run everything in containers (including apps) with a docker compose file. If I'm missing some secret functionality, please let me know, but I have not found a way to run Ruby lsp in the container and connect to it remotely. I think it should be possible to use Neovim's LSP RPC functionality if it's possible to run Ruby LSP on a port within the container. Maybe related to #1782 ? |
Beta Was this translation helpful? Give feedback.
-
|
My ideal scenario would be this one:
|
Beta Was this translation helpful? Give feedback.
-
|
Hi @vinistock, thank you for centralizing the discussion here. I’d like to offer a slightly different perspective. It feels like we are focusing heavily on "how to fit everything into VS Code's native container support (Dev Containers)", whereas the reality for many teams involves complex docker compose setups that exist independently of the editor. As users, we often cannot or do not want to migrate our entire workflow to VS Code Dev Containers. Furthermore, while the current focus is on the VS Code extension, ruby-lsp itself is a server that should ideally remain agnostic. Focusing too tightly on VS Code's internal remote architecture might limit the server's portability to other editors (Neovim, Emacs, Zed, etc.) that face similar challenges. Fundamentally, running the LSP in a containerized environment (without Dev Containers) boils down to solving two distinct problems:
Regarding the concern about the File System API: In a typical docker compose setup, the source code is mounted via volumes. This means the files do exist on the user's machine. The editor can read/write them locally as usual. The only missing piece is the translation layer—telling the LSP that /Users/me/project/file.rb on the host corresponds to /app/file.rb inside the container. We don't necessarily need to rebuild a full FS abstraction layer on top of VS Code. If we solve the Path Mapping (translating URIs between client and server) and the Execution Command, we solve the majority of these "complex setup" use cases without forcing full Dev Container adoption. My PR #2919 attempted to address exactly these two points: allowing a custom launch command and handling the path mapping logic. I believe revisiting this "lighter" approach is crucial for supporting existing Docker workflows that cannot be replaced by VS Code Remote Containers. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
We have a few issues related to better container support, in particular in complex setups that aren't simply having the editor connect to a single container. For example, a container with multiple projects inside or a container-inside-container situation.
I want to centralize all information into a single place (this discussion) so that we can more easily see the full picture and start deriving concrete tasks from it. From all of the related issues, we need to understand what exactly is the shortcoming with the solution provided by VS Code for more complex container setups.
Related issues/prs: #2223, #3386, #2919, #3586
The current container support
Currently, container support for the Ruby LSP relies entirely on VS Code's container support. This is ideal for extensions because the editor itself handles everything - and it is in a better position to do so.
Connecting to a container means that:
vscode.workspace.fsAPIExtensions do not have to be concerned at all with where they are running. The editor knows where it is running and can abstract away all of the complexity.
What we need to understand
Ideally, we can push for a better solution at the editor level, so that all languages and extensions are benefitted from more elaborate container support. If that's not possible or if the VS Code team is not open to making their integrations more complex, then we need to understand the level of effort involved in rolling out our own version of it.
For example, #3386 proposes customizing the command to launch the language server, but that solution is incomplete as other shell commands we try to run will not be executed within the container. Exactly the same scenario for #3586, which proposes a similar solution that only fixes test related commands.
Someone might then propose allowing all commands to be prefixed by something like
dip, but none of these would solve the file system API problem and there's simply no way that we can provide rich editor features without the ability of reading a file on the extension side. When invoking allvscode.workspace.fsAPIs, we would end up reading files in the user’s machine instead of the container.Next concrete steps
dipis easy, but adding our own file system layer on top of VS Code's is definitely not. We would essentially be building the solution that should live in the editor ourselves.Important note: we may still decide to not support certain use cases even after gathering more details. The Ruby LSP is an extension for language support, which is already complex enough without broadening its scope into dealing with containerized environments.
Beta Was this translation helpful? Give feedback.
All reactions