emacs-lsp / lsp-docker

Scripts and configurations to leverage lsp-mode in docker environment
GNU General Public License v3.0
241 stars 34 forks source link

does lsp support mapping multiple source dirs to multiple destinations #92

Open korenhe opened 1 month ago

korenhe commented 1 month ago

by using .lsp-docker.yaml, it is good for mapping only one source to one destinations like this :

  mappings:
    - source: "~/A"
      destination: "A-in-docker"

myquestion is, is it possible to map multiple dirs, such as:

  mappings:
    - source: "~/A"
       destination: "A-in-docker"
    - source: "~/B"
      destination: "B-in-docker" 

my simple test result failed to start the docker container error, though i can copy B into A so I can mount one folder, but i think mount multiple folders may be easier to use.

factyy commented 1 month ago

Right now it is not possible to map multiple source dirs.

Can be implemented as an additional feature though. I'll take a look when I have enough time

factyy commented 3 weeks ago

@korenhe , just rechecked the feature: it looks like it is already implemented.

Are both of your source dirs inside a single project root (current implementation allows you to map only project root child folders)?

korenhe commented 3 weeks ago

@factyy , my use case is in the host, the two folders are not in one root project, I need the mapping volumes to map those two folders to one root project in the docker. If the host folders are already in same root project, It seems not necessary to map the subfolders, right? since they are already there.

factyy commented 3 weeks ago

@korenhe , the idea behind these limitations is simple: to avoid security risks (e.g. you are running "rootful" Docker with a root user inside the container) and accidentally map a sensitive root-owned directory on the host (e.g. /etc) into the container. Than you can modify this directory from inside the container.

So right now any mapping is checked against the project root. You may not map the project root dir itself but a few separate folders down the directory tree.