Shougo / neosnippet.vim

neo-snippet plugin
Other
1.12k stars 108 forks source link

If lspitem.insertText does not exist, use lspitem.label #497

Closed justinas closed 4 years ago

justinas commented 4 years ago

I have encountered that errors are thrown when used with LanguageClient-neovim and typescript-language-server due to the fact it sends CompletionItem without insertText attribute, only with label. Related: https://github.com/theia-ide/typescript-language-server/issues/130

function add(x: number, y: number): number {
    return x + y;
}

add(
Error detected while processing function neosnippet#complete_done[1]..neosnippet#mappings#_complete_done[1]..<SNR>
100_get_completed_snippets[6]..<SNR>100_get_user_data:                                                            
line   23:                                                                                                        
E716: Key not present in Dictionary: insertText

Langserver specification says this about CompletionItem.insertText:

* A string that should be inserted into a document when selecting
* this completion. When `falsy` the label is used.

The fix in this PR should account for these cases.

Shougo commented 4 years ago

Thanks