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

Issue:
TexLab configuration
## Is your feature request related to a problem? Please describe.

In order to [configure the texlab language server](https://texlab.netlify.com/docs/reference/configuration):

* texlab only use the `workspace/configuration` request to fetch the configuration from the client.
* LanguageClient-Neovim only use the `workspace/didChangeConfiguration` request to push the configuration to the server.

## Describe the solution you'd like

It would be nice if LanguageClient-neovim could support the  `workspace/configuration` request so that all features of texlab can be used together with LanguageClient-Neovim!

## Additional context

Here is the mirrored feature request made on the TexLab repo: https://github.com/latex-lsp/texlab/issues/123


Discussion / hints:

Fix patch:
diff --git a/src/language_server_protocol.rs b/src/language_server_protocol.rs
index e3a31955..5c32103b 100644
--- a/src/language_server_protocol.rs
+++ b/src/language_server_protocol.rs
@@ -26,8 +26,8 @@ use lsp_types::{
     CodeActionContext, CodeActionKind, CodeActionKindLiteralSupport, CodeActionLiteralSupport,
     CodeActionOrCommand, CodeActionParams, CodeActionResponse, CodeLens, Command,
     CompletionCapability, CompletionItem, CompletionItemCapability, CompletionResponse,
-    CompletionTextEdit, Diagnostic, DiagnosticSeverity, DidChangeConfigurationParams,
-    DidChangeTextDocumentParams, DidChangeWatchedFilesParams,
+    CompletionTextEdit, ConfigurationParams, Diagnostic, DiagnosticSeverity,
+    DidChangeConfigurationParams, DidChangeTextDocumentParams, DidChangeWatchedFilesParams,
     DidChangeWatchedFilesRegistrationOptions, DidCloseTextDocumentParams,
     DidOpenTextDocumentParams, DidSaveTextDocumentParams, DocumentChangeOperation, DocumentChanges,
     DocumentFormattingParams, DocumentHighlight, DocumentHighlightKind,
@@ -963,6 +963,7 @@ impl LanguageClient {
                     }),
                     workspace: Some(WorkspaceClientCapabilities {
                         apply_edit: Some(true),
+                        configuration: Some(true),
                         did_change_watched_files: Some(GenericCapability {
                             dynamic_registration: Some(true),
                         }),
@@ -1791,6 +1792,23 @@ impl LanguageClient {
         Ok(())
     }
 
+    pub fn workspace_configuration(&self, params: &Value) -> Result<Value> {
+        let config_params = ConfigurationParams::deserialize(params)?;
+
+        let settings = self.get_state(|state| state.initialization_options.clone())?;
+
+        let configuration_items = config_params
+            .items
+            .into_iter()
+            .filter_map(|item| {
+                let section = format!("/{}", item.section?.replace(".", "/"));
+                settings.pointer(&section).cloned()
+            })
+            .collect::<Value>();
+
+        Ok(configuration_items)
+    }
+
     pub fn handle_code_lens_action(&self, params: &Value) -> Result<Value> {
         let filename = self.vim()?.get_filename(params)?;
         let line = self.vim()?.get_position(params)?.line;
diff --git a/src/rpchandler.rs b/src/rpchandler.rs
index caace423..017f0f8d 100644
--- a/src/rpchandler.rs
+++ b/src/rpchandler.rs
@@ -86,6 +86,7 @@ impl LanguageClient {
             request::Rename::METHOD => self.text_document_rename(&params),
             request::DocumentSymbolRequest::METHOD => self.text_document_document_symbol(&params),
             request::ShowMessageRequest::METHOD => self.window_show_message_request(&params),
+            request::WorkspaceConfiguration::METHOD => self.workspace_configuration(&params),
             request::WorkspaceSymbol::METHOD => self.workspace_symbol(&params),
             request::CodeActionRequest::METHOD => self.text_document_code_action(&params),
             request::Completion::METHOD => self.text_document_completion(&params),


Test patch: