Skip to content
This repository was archived by the owner on Apr 9, 2021. It is now read-only.
This repository was archived by the owner on Apr 9, 2021. It is now read-only.

Server returns snippets even if client doesn't claim to support them #2

@puremourning

Description

@puremourning

The completion request always returns snippet-type completions, even if the client initialisation request doesn't claim to support them.

Logs:

  • Initialize does not include snippetSupport: true which should be interpreted as not supporting snippets (only plaintext)
2019-07-05 22:50:43,665 - DEBUG - TX: Sending message: b'Content-Length: 654\r\n\r\n{"id": "1", "jsonrpc": "2.0", "method": "initialize", "params": {"capabilities": {"textDocument": {"completion": {"completionItemKind": {"valueSet": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]}}, "hover": {"contentFormat": ["plaintext", "markdown"]}, "signatureHelp": {"signatureInformation": {"documentationFormat": ["plaintext", "markdown"], "parameterInformation": {"labelOffsetSupport": false}}}}}, "initializationOptions": {}, "processId": 59131, "rootPath": "/Users/ben/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd", "rootUri": "file:///Users/ben/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd"}}'
  • completion request
2019-07-05 22:50:47,662 - DEBUG - TX: Sending message: b'Content-Length: 199\r\n\r\n{"id": "2", "jsonrpc": "2.0", "method": "textDocument/completion", "params": {"position": {"character": 3, "line": 5}, "textDocument": {"uri": "file:///Users/ben/Development/lsp/json/package.json"}}}'
  • response (snipped)
2019-07-05 22:50:47,665 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","id":"2","result":{"items":[{"kind":10,"label":"$schema","insertText":"\\"\\\\$schema\\": $1","insertTextFormat":2,"documentation":"","filterText":"\\"$schema\\"","textEdit":{"range":{"start":{"line":5,"character":2},"end":{"line":5,"character":3}},"newText":"\\"\\\\$schema\\": $1"}}],"isIncomplete":false}}'

Note: "insertTextFormat":2 is 'snippet' :

	/**
	 * The primary text to be inserted is treated as a snippet.
	 *
	 * A snippet can define tab stops and placeholders with `$1`, `$2`
	 * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
	 * the end of the snippet. Placeholders with equal identifiers are linked,
	 * that is typing in one will update others too.
	 */
	export const Snippet = 2;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions