Closed kvaneesh closed 6 years ago
It shouldn't impact invalid region. Does cross reference (definition,references,$cquery/vars,...) work in the buffer? Are these checklist items satisfied?
The LSP rootUri is now decided by the following function:
(defun cquery--get-root ()
"Return the root directory of a cquery project."
(expand-file-name (or (locate-dominating-file default-directory "compile_commands.json")
(locate-dominating-file default-directory ".cquery")
default-directory)))
It may work in project roots where neither compile_commands.json
nor .cquery
is found. But i'm unclear if this is robust enough.
I was expecting cquery to not do anything if it doesn't find compile_commands.json. That is those #ifdef CONFIG_NUMA I want it to render as on the right side frame.
Sorry I don't quite get your point.
(cquery-use-default-rainbow-sem-highlight)
this takes effect only if you call it, otherwise faces won't change. There is another custom variable called cquery-enable-sem-highlight
which defaults to nil
(I just changed it from t
to nil
). If you don't want any semantic highlighting, disable it.compile_commands.json
nor .cquery
is found, don't call (lsp-cquery-enable)
.cquery-enable-inactive-region
. If you do not want regions be shadowed, set it to nil
.So now I am calling lsp-cquery-enable in the c-mode-hook . and I also have cquery-use-default-rainbow-sem-highlight in the :config part of use-package macro. The below is what I do to get it configured.
(defun lsp-cquery/init-cquery () (use-package cquery :init (progn (spacemacs/add-to-hooks #'lsp-cquery-enable '(c-mode-hook c++-mode-hook)) (dolist (mode '(c-mode c++-mode)) (evil-leader/set-key-for-mode mode "r." 'xref-find-definitions "r," 'xref-find-references "rs" 'xref-pop-marker-stack "rl" 'helm-imenu ))) :config (progn (setq cquery-executable "/abc/cquery/bin/cquery") (cquery-use-default-rainbow-sem-highlight)) ))
My expectation was if the project root doesn't have compile_commands.json cquery should not introduce any change because it clearly doesn't have enough info to parse the file. Is that assumption wrong? If so how I should configure cquery on different projects, some having compile_commands.json and some not.
For projects without compile_commands.json I am using gtags for symbol lookup and references.
I recommend you to check out https://github.com/jacobdufault/cquery/wiki/Emacs , 'xref-pop-marker-stack is actually very bad and should be replaced with lsp-ui-peek-jump-{backward,forward}
Some recent commits in cquery make it able to handle a single file without .cquery
or compile_commands.json
. I think it is quite handy so I removed user-error
from cquery--get-root
when these marker files are not found.
Adding lsp-cquery-enable
unconditionally to c-mode-hook
is a bad idea. I'm thinking adding a cquery layer after https://github.com/syl20bnr/spacemacs/pull/10211 is checked in.
Filed https://github.com/emacs-lsp/lsp-mode/issues/255 , which may be related.
https://github.com/syl20bnr/spacemacs/pull/10236
cquery-project-blacklist
might be handy
I've also sent out a patch to make lsp-project-whitelist
lsp-project-blacklist
flexible so you can have regex patterns to exclude (say whole /tmp/.*
)
I have projects that don't have compile_commands.json present. Should I expect the semantic high light to impact display of the code there? Below is the two snapshots of the same file with cquery enabled and disabled. Left side frame is with cquery enabled and right side frame is with cquery disabled.