emacs-lsp / emacs-ccls

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

How to pass complex command line arguments via ccls-args? #72

Closed sefeng211 closed 4 years ago

sefeng211 commented 4 years ago

Hi I am a Emacs newbie and sorry if this has been documented somewhere.

I tried to set the arguments as (setq ccls-args '("--log-file=/tmp/ccls_log.txt --init='{\"index\": {\"threads\": 4, \"initialBlacklist\": [\".\"]}}'")), and this didn't seem to be parsed correctly, as ccls still used all the cores.

I also tried to do something like (setq ccls-args '("--log-file=/tmp/ccls_log.txt" "--init='{\"index\": {\"threads\": 4, \" initialBlacklist\": [\".\"]}}'")), and this one also didn't work, and the server seemed fail to start.

Thanks!

MaskRay commented 4 years ago

(setq ccls-args '("--log-file=/tmp/ccls_log.txt" "--init={\"index\": {\"threads\": 4, \" initialBlacklist\": [\".\"]}}"))

If you write --init='{...}' in a shell, the shell will not pass single quotes to the process. You may read some documents about shell quoting.

It is probably simpler using a shell script wrapper https://github.com/MaskRay/ccls/wiki/Install#shell-script-wrapper