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

Snippet expansion partially broken? #10

Closed Sarcasm closed 6 years ago

Sarcasm commented 6 years ago

I'm not sure this is an issue with emacs-cquery, but when I do completion in a clean Emacs, I have the feeling snippets aren't available at first. If I revert the buffer and try again, it seems to work.

Can you reproduce the issue? I'm not sure, but I don't think I noticed this issue initially.

Is it possible that one of the recent commit in cquery triggered this?

MaskRay commented 6 years ago

The two commits address issues when an editor does not support snippets (snippetSupport: false). lsp-mode announces it supports snippets (check with M-x lsp-capabilities) so the two commits should have no effect.

Here is a sample response

{
  "jsonrpc": "2.0",
  "id": 61,
  "result": {
    "isIncomplete": false,
    "items": [
      {
        "label": "insert",
        "kind": 2,
        "detail": "std::vector<int, std::allocator<int> >::iterator insert(std::vector<int, std::allocator<int> >::const_iterator __position, const std::vector<int, std::allocator<int> >::value_type &__x)",
        "documentation": "",
        "sortText": "...........",
        "insertText": "insert(${1:std::vector<int, std::allocator<int> >::const_iterator __position}, ${2:const std::vector<int, std::allocator<int> >::value_type &__x})$0",
        "insertTextFormat": 2
      }
    ]
  }
}
Sarcasm commented 6 years ago

Sorry for this bug report, it was due to my config. When my Emacs start, I enable yasnippet "lazily" after some idle time. I guess LSP does not like it when yasnippet is enabled/disabled dynamically.