Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to define docker lsp clients only for certain paths #39

Open
aidalgol opened this issue May 13, 2021 · 1 comment
Open

Add ability to define docker lsp clients only for certain paths #39

aidalgol opened this issue May 13, 2021 · 1 comment

Comments

@aidalgol
Copy link
Contributor

I have started using lsp-docker with elixir-ls along with elixir under docker so that I can use whichever version of the LS I need for a given Elixir project. But now that I have started another Elixir project using my system's Elixir version (instead of via docker), I have discovered that my elixir-ls docker client is taking precedence over the client defined in the lsp-elixir elisp package.

The lsp-related part of my init:

;; Set up LSP Docker
(add-to-list 'load-path "~/src/elisp/lsp-docker")
(load-library "lsp-docker")

(with-eval-after-load "lsp-elixir"
  (lsp-docker-init-clients
   :path-mappings '(("/home/aidan/src" . "/projects"))
   :client-configs '((:server-id elixir-ls
                      ;;:priority -5
                      :docker-server-id elixirls-docker:1-10
                      :docker-image-id "elixir-ls:1.10"
                      :docker-container-name "lsp-elixir-container"
                      :server-command "language_server.sh"))))

;; Specify which projects should use which LSP clients.
(dir-locals-set-class-variables 'elixirls-docker:1-10
  '((nil . ((lsp-enabled-clients . (elixirls-docker:1-10))
            (eval . (add-hook 'elixir-mode-hook #'lsp))))))

(dir-locals-set-directory-class
 "/home/aidan/src/junk" 'elixirls-docker:1-10)

On discord, @yyoncho proposed adding the ability to specify an lsp-docker client only for certain paths.

@factyy
Copy link
Collaborator

factyy commented Feb 8, 2022

@aidalgol , take a look into the current implementation: if you use wrapper functions (like lsp-docker-register) with a valid configuration, it will register an lsp docker client only for this particular path (in case you are using single folder mapping as in your example).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants