Repository: autozimu/LanguageClient-neovim (language: rust)

Issue:
snippet support broken at 657ad707
Prior to 657ad707, I had snippet support working fine with ultisnips and ncm2-ultisnips.

But after 657ad707, the language client does not recognise that ultisnips supports snippets.  So it declares that I don't have snippet support, and no server will play along.

To be fair I did have to do a (small) amount of customisation to get this working, so the language client is not completely wrong when it says that snippets are not supported.  But I *have* made it work, and now it doesn't!

Sadly I can't override the language client's opinion: setting `g:LanguageClient_hasSnippetSupport = 1` doesn't turn on snippet support - though it sounds as though it ought to.  As it stands, that variable would be better re-named `g:LanguageClient_doNotDisableSnippetSupport`.

Can we please make this work again?  Maybe with a new setting so that I can force snippet support on, maybe by changing the meaning of the existing setting, maybe something else altogether...?


Discussion / hints:
Suggest changing `s:hasSnippetSupport()` to go something like this:

```viml
if exists('g:LanguageClient_hasSnippetSupport')
    "user has chosen to force the issue, respect that choice
    return g:LanguageClient_hasSnippetSupport
endif

" else decide by checking for plug-ins known to support snippets
...

Fix patch:
diff --git a/autoload/LanguageClient.vim b/autoload/LanguageClient.vim
index 7987347c..befb876c 100644
--- a/autoload/LanguageClient.vim
+++ b/autoload/LanguageClient.vim
@@ -103,8 +103,8 @@ function! s:Debug(message) abort
 endfunction
 
 function! s:hasSnippetSupport() abort
-    if get(g:, 'LanguageClient_hasSnippetSupport', 1) !=# 1
-        return 0
+    if exists('g:LanguageClient_hasSnippetSupport')
+        return g:LanguageClient_hasSnippetSupport !=# 0
     endif
 
     " https://github.com/Shougo/neosnippet.vim
diff --git a/doc/LanguageClient.txt b/doc/LanguageClient.txt
index 09ebda7d..f002f9f2 100644
--- a/doc/LanguageClient.txt
+++ b/doc/LanguageClient.txt
@@ -265,7 +265,12 @@ Valid option: Array<String> | String
 
 Override detection of snippet support.
 
-Default: 1
+If this is not set, the language client will determine whether snippets are
+supported by looking for installed plugins that are known to support them.
+
+Set to 1 (or 0) to enable (or disable) snippet support, skipping the automatic
+detection.
+
 Valid options: 1 | 0
 
 2.18 g:LanguageClient_waitOutputTimeout   *g:LanguageClient_waitOutputTimeout*


Test patch: