@@ -26,8 +26,8 @@ use lsp_types::{
26
26
CodeActionContext , CodeActionKind , CodeActionKindLiteralSupport , CodeActionLiteralSupport ,
27
27
CodeActionOrCommand , CodeActionParams , CodeActionResponse , CodeLens , Command ,
28
28
CompletionCapability , CompletionItem , CompletionItemCapability , CompletionResponse ,
29
- CompletionTextEdit , Diagnostic , DiagnosticSeverity , DidChangeConfigurationParams ,
30
- DidChangeTextDocumentParams , DidChangeWatchedFilesParams ,
29
+ CompletionTextEdit , ConfigurationParams , Diagnostic , DiagnosticSeverity ,
30
+ DidChangeConfigurationParams , DidChangeTextDocumentParams , DidChangeWatchedFilesParams ,
31
31
DidChangeWatchedFilesRegistrationOptions , DidCloseTextDocumentParams ,
32
32
DidOpenTextDocumentParams , DidSaveTextDocumentParams , DocumentChangeOperation , DocumentChanges ,
33
33
DocumentFormattingParams , DocumentHighlight , DocumentHighlightKind ,
@@ -963,6 +963,7 @@ impl LanguageClient {
963
963
} ) ,
964
964
workspace : Some ( WorkspaceClientCapabilities {
965
965
apply_edit : Some ( true ) ,
966
+ configuration : Some ( true ) ,
966
967
did_change_watched_files : Some ( GenericCapability {
967
968
dynamic_registration : Some ( true ) ,
968
969
} ) ,
@@ -1791,6 +1792,23 @@ impl LanguageClient {
1791
1792
Ok ( ( ) )
1792
1793
}
1793
1794
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
+
1794
1812
pub fn handle_code_lens_action ( & self , params : & Value ) -> Result < Value > {
1795
1813
let filename = self . vim ( ) ?. get_filename ( params) ?;
1796
1814
let line = self . vim ( ) ?. get_position ( params) ?. line ;
0 commit comments