tigersoldier / company-lsp

Company completion backend for lsp-mode
GNU General Public License v3.0
251 stars 26 forks source link

no completion at point with ccls #95

Closed psteinb closed 5 years ago

psteinb commented 5 years ago

I just upgraded to company-lsp 20190314.710 with lsp-mode 20190317.1425 and I get only completions on blank lines in c++-mode. As soon as I want to complete member functions, member fields, functions inside namespaces, I only get No completion found (when calling company-complete) or Cannot complete at point (when calling company-lsp). lsp-find-references or lsp-find-definitions works accross the project just fine.

I was hoping that company-lsp would parse my entire project as it is interfacing to lsp and complete based on this. I am using ccls at version 20190225.1410. I am not sure how to debug the issue. Any help would be appreciated. Thanks.

yyoncho commented 5 years ago

Can you set lsp-print-io to t and inspect *lsp-log* and eventually post the client-server communication when you see the error "No completion found"?

psteinb commented 5 years ago

ok, did that and saved the *lsp-log* buffer. it appears cut off though. lsp-io.log lsp-io.log

I was trying to complete the following:

std::vector<double> ri_image(ct::N_DIMS,0.),
      rj_image( ct::N_DIMS,0.),
      rcl_image(ct::N_DIMS,0.),
      ref_image(ct::N_DIMS,0.);

  rcl_image.p
yyoncho commented 5 years ago
>>> ccls:30865(async)
Content-Length: 265

{
  "jsonrpc": "2.0",
  "method": "textDocument/completion",
  "params": {
    "textDocument": {
      "uri": "file:///home/steinbac/development/filament-networks++/main.cpp"
    },
    "position": {
      "line": 300,
      "character": 13
    }
  },
  "id": 73
}

<<<< ccls:30865
{
  "jsonrpc": "2.0",
  "id": 73,
  "result": {
    "isIncomplete": false,
    "items": []
  }
}

the issue seems to be in ccls server (cc @MaskRay )

MaskRay commented 5 years ago

I am using ccls at version 20190225.1410.

I'm not sure what this version is :( Can you update it to the latest one or use one of the stable releases 0.20181225.9 0.20190314?

    "message": "no member named 'cout' in namespace 'std'"
    "message": "use of undeclared identifier 'spdlog'"

It looks you haven't configured cflags correctly. https://github.com/MaskRay/ccls/wiki/Project-Setup https://github.com/MaskRay/ccls/wiki/Install#clang-resource-directory You may start from a simple example like:

#include <stdio.h>
int main() {
  <trigger completion here and find gets, puts, etc>
psteinb commented 5 years ago

thanks a bunch - just starred this repo. That worked like a charm. Updated to 0.20190314 and created the .ccls file. Now, the only thing left is xref-find-references which throws lsp--location-to-td-position: Wrong type argument: hash-table-p, nil. I am glad it all works now.