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

Add support for persisting configurations #50

Closed factyy closed 2 years ago

factyy commented 2 years ago

Adding support for persisting configurations via a config stored in the project root.

Configs are yaml files that are named .lsp-docker.yml or .lsp-docker.yaml and look like this:

lsp:
  server:
    type: docker
    subtype: container # Or image. container subtype means launching an existing container
    # image type means creating a new container each time from a specified image
    name: not-significant-but-unique-name
    server: server-id-of-the-base-server # Server id of a registered server (by lsp-mode) 
    launch_command: "launch command with arguments" # Launch command of the language server
    # (selected by a server id specified above) in stdio mode
  mappings:
    - source: "/your/host/source/path"
      destination: "/your/local/path/inside/a/container"

Analysis starts by invoking an interactive function lsp-docker-register or lsp-docker-start (if you want not only to register the server but to start it immediately after) when you have opened a file from the project you wanted to use a containerized language server with

factyy commented 2 years ago

@yyoncho , do I have to patch anything else?

yyoncho commented 2 years ago

Thank you for contributing to lsp-mode! If you want you may write an article/blog/tutorial about this feature. If you don't have a place to host it you may arrange it as lsp-mode tutorial - https://emacs-lsp.github.io/lsp-mode/tutorials/CPP-guide/