cquery-project / emacs-cquery

Emacs client for cquery, a low-latency language server supporting multi-million line C++ code-bases
116 stars 14 forks source link

company-lsp fails #2

Closed jwintz closed 6 years ago

jwintz commented 6 years ago

For this one to work, I had to copy my compile_commands.json out of the build dir to the project dir.

From cquery.el

(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)))

Should use a cquery-cdb-default-dir with a dolist. See https://github.com/cquery-project/emacs-cquery/commit/de032bf94976cff86425a76f2c1aa4cbd9552ff2

However company-lsp gives me:

Debugger entered--Lisp error: (wrong-type-argument hash-table-p nil)
  gethash("completionProvider" nil)
  company-lsp(prefix)
  apply(company-lsp prefix)
  company-call-backend-raw(prefix)
  apply(company-call-backend-raw prefix)
  company--force-sync(company-call-backend-raw (prefix) company-lsp)
  company-call-backend(prefix)
  company--begin-new()
  company--perform()
  company-auto-begin()
  company-idle-begin(#<buffer Controller.cpp> #<window 3 on *Backtrace*> 2716 6885)
  apply(company-idle-begin (#<buffer Controller.cpp> #<window 3 on *Backtrace*> 2716 6885))
  timer-event-handler([t 23138 26753 841744 nil company-idle-begin (#<buffer Controller.cpp> #<window 3 on *Backtrace*> 2716 6885) nil 0])

Moreover M-. and M.? does not give me any result.

Using latest cquery and latest cquery.el forked into my config.

MaskRay commented 6 years ago

https://github.com/jacobdufault/cquery/wiki/Emacs#checklist

M-x lsp-capabilities LSP workspace is initialized correctly
M-: xref-backend-functions is (lsp--xref-backend) for cross references
M-: completion-at-point-functions is (lsp-completion-at-point) for completion
jwintz commented 6 years ago

Hi, as of https://github.com/cquery-project/emacs-cquery/commit/f0dcfaec5d45731fc6d457bc3cf9cf080710cc5e, the emacs interface to the updated cquery works, assuming I move my compile commands in the project root dir.

M-x lsp-capabilities:

The server provides code lens
The server provides code actions
The server provides project symbol support
The server provides file symbol support
The server provides references support
The server provides goto definition support
The server provides completion support
The server provides hover support
Document sync method: Send full contents

Awesome !