tigersoldier / company-lsp

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

textEdit completion from ccls doesn't expand correctly #120

Closed dervus closed 5 years ago

dervus commented 5 years ago

It seems like company-lsp ignores "textEdit" and inserts "label" as is instead. The problem is that "label" is a full function signature, and I want to insert only function name.

image and after (company-indent-or-complete-common) image

Here's completion response from ccls language server with snippets disabled:

[Trace - 01:52:19 ] Received response 'textDocument/completion - (28)' in 2ms.
Result: {
  "items": [
    {
      "textEdit": {
        "newText": "my_awesome_add(",
        "range": {
          "end": {
            "character": 19,
            "line": 8
          },
          "start": {
            "character": 15,
            "line": 8
          }
        }
      },
      "insertTextFormat": 1,
      "filterText": "my_awesome_add",
      "sortText": "   !",
      "detail": "",
      "kind": 3,
      "label": "my_awesome_add(int a, int b) -> int"
    },
    {
      "textEdit": {
        "newText": "LC_MONETARY_MASK",
        "range": {
          "end": {
            "character": 19,
            "line": 8
          },
          "start": {
            "character": 15,
            "line": 8
          }
        }
      },
      "insertTextFormat": 1,
      "sortText": "   \"",
      "detail": "",
      "kind": 18,
      "label": "LC_MONETARY_MASK"
    }
  ],
  "isIncomplete": null
}

I tested this with both snippet support enabled and disabled. Server seems to respond correctly in both cases.

yyoncho commented 5 years ago

I guess you are using tng company frontend which does not work with snippets - check https://github.com/company-mode/company-mode/issues/891 . Looks like you are using doom and it does that by default.

dervus commented 5 years ago

Disabling tng frontend indeed solved this. Thanks! I'll have to look into emulating tng behavior in other ways.