@@ -26,8 +26,8 @@ use lsp_types::{
2626 CodeActionContext , CodeActionKind , CodeActionKindLiteralSupport , CodeActionLiteralSupport ,
2727 CodeActionOrCommand , CodeActionParams , CodeActionResponse , CodeLens , Command ,
2828 CompletionCapability , CompletionItem , CompletionItemCapability , CompletionResponse ,
29- CompletionTextEdit , Diagnostic , DiagnosticSeverity , DidChangeConfigurationParams ,
30- DidChangeTextDocumentParams , DidChangeWatchedFilesParams ,
29+ CompletionTextEdit , ConfigurationParams , Diagnostic , DiagnosticSeverity ,
30+ DidChangeConfigurationParams , DidChangeTextDocumentParams , DidChangeWatchedFilesParams ,
3131 DidChangeWatchedFilesRegistrationOptions , DidCloseTextDocumentParams ,
3232 DidOpenTextDocumentParams , DidSaveTextDocumentParams , DocumentChangeOperation , DocumentChanges ,
3333 DocumentFormattingParams , DocumentHighlight , DocumentHighlightKind ,
@@ -963,6 +963,7 @@ impl LanguageClient {
963963 } ) ,
964964 workspace : Some ( WorkspaceClientCapabilities {
965965 apply_edit : Some ( true ) ,
966+ configuration : Some ( true ) ,
966967 did_change_watched_files : Some ( GenericCapability {
967968 dynamic_registration : Some ( true ) ,
968969 } ) ,
@@ -1791,6 +1792,23 @@ impl LanguageClient {
17911792 Ok ( ( ) )
17921793 }
17931794
1795+ pub fn workspace_configuration ( & self , params : & Value ) -> Result < Value > {
1796+ let config_params = ConfigurationParams :: deserialize ( params) ?;
1797+
1798+ let settings = self . get_state ( |state| state. initialization_options . clone ( ) ) ?;
1799+
1800+ let configuration_items = config_params
1801+ . items
1802+ . into_iter ( )
1803+ . filter_map ( |item| {
1804+ let section = format ! ( "/{}" , item. section?. replace( "." , "/" ) ) ;
1805+ settings. pointer ( & section) . cloned ( )
1806+ } )
1807+ . collect :: < Value > ( ) ;
1808+
1809+ Ok ( configuration_items)
1810+ }
1811+
17941812 pub fn handle_code_lens_action ( & self , params : & Value ) -> Result < Value > {
17951813 let filename = self . vim ( ) ?. get_filename ( params) ?;
17961814 let line = self . vim ( ) ?. get_position ( params) ?. line ;
0 commit comments