emacs-lsp / emacs-ccls

Emacs client for ccls, a C/C++ language server
200 stars 29 forks source link

Add ccls-process-wrapper-function #31

Closed liff closed 5 years ago

liff commented 5 years ago

To make it possible to run ccls in nix-shell. Blatantly stolen almost verbatim from lsp-haskell.

MaskRay commented 5 years ago

I am not sure why this patch is needed for Nix. Can't you just make up nix-shell command line with ccls-executable and ccls-args?

https://github.com/emacs-lsp/lsp-haskell/pull/26

liff commented 5 years ago

The command needs to refer to shell.nix within the project. Given that ccls-executable and -args are variables, I don’t see how that could be done with them.

MaskRay commented 5 years ago

I think you can leverage dynamic binding of ccls-executable ccls-args

(defun +nix/ccls
  (let ((ccls-executable "nix-shell") (ccls-args `("-I" "." "--command" ...))
    (lsp)))
liff commented 5 years ago

That works, thanks and sorry.

I suppose the reason why lsp-haskell has it is that one can just call (lsp) directly.

MaskRay commented 5 years ago

I suppose the reason why lsp-haskell has it is that one can just call (lsp) directly.

I've also commented in its PR as I don't think this custom variable is necessary. In any case, the example used isn't good either: the used append/list functions have some redundancy.

You can call (lsp) directly if you (setq ccls-executable .. ccls-args ..) correctly.