@@ -187,6 +187,7 @@ use crate::lsp::non_wasm::queue::HeavyTaskQueue;
187187use crate :: lsp:: non_wasm:: queue:: LspEvent ;
188188use crate :: lsp:: non_wasm:: queue:: LspQueue ;
189189use crate :: lsp:: non_wasm:: transaction_manager:: TransactionManager ;
190+ use crate :: lsp:: non_wasm:: workspace:: DisabledLanguageServicesConfig ;
190191use crate :: lsp:: non_wasm:: workspace:: LspAnalysisConfig ;
191192use crate :: lsp:: non_wasm:: workspace:: Workspace ;
192193use crate :: lsp:: non_wasm:: workspace:: Workspaces ;
@@ -853,17 +854,28 @@ impl Server {
853854 if let Some ( params) = self
854855 . extract_request_params_or_send_err_response :: < HoverRequest > ( params, & x. id )
855856 {
856- let default_response = Hover {
857- contents : HoverContents :: Array ( Vec :: new ( ) ) ,
858- range : None ,
859- } ;
860- let transaction =
861- ide_transaction_manager. non_committable_transaction ( & self . state ) ;
862- self . send_response ( new_response (
863- x. id ,
864- Ok ( self . hover ( & transaction, params) . unwrap_or ( default_response) ) ,
865- ) ) ;
866- ide_transaction_manager. save ( transaction) ;
857+ // Check if hover is disabled
858+ if self . is_service_disabled ( & params. text_document_position_params . text_document . uri , |d| d. hover . unwrap_or ( false ) ) {
859+ self . send_response ( new_response (
860+ x. id ,
861+ Ok ( Hover {
862+ contents : HoverContents :: Array ( Vec :: new ( ) ) ,
863+ range : None ,
864+ } ) ,
865+ ) ) ;
866+ } else {
867+ let default_response = Hover {
868+ contents : HoverContents :: Array ( Vec :: new ( ) ) ,
869+ range : None ,
870+ } ;
871+ let transaction =
872+ ide_transaction_manager. non_committable_transaction ( & self . state ) ;
873+ self . send_response ( new_response (
874+ x. id ,
875+ Ok ( self . hover ( & transaction, params) . unwrap_or ( default_response) ) ,
876+ ) ) ;
877+ ide_transaction_manager. save ( transaction) ;
878+ }
867879 }
868880 } else if let Some ( params) = as_request :: < InlayHintRequest > ( & x) {
869881 if let Some ( params) = self
@@ -925,16 +937,24 @@ impl Server {
925937 params, & x. id ,
926938 )
927939 {
928- let transaction =
929- ide_transaction_manager. non_committable_transaction ( & self . state ) ;
930- self . send_response ( new_response (
931- x. id ,
932- Ok ( DocumentSymbolResponse :: Nested (
933- self . hierarchical_document_symbols ( & transaction, params)
934- . unwrap_or_default ( ) ,
935- ) ) ,
936- ) ) ;
937- ide_transaction_manager. save ( transaction) ;
940+ // Check if document symbols are disabled
941+ if self . is_service_disabled ( & params. text_document . uri , |d| d. document_symbol . unwrap_or ( false ) ) {
942+ self . send_response ( new_response (
943+ x. id ,
944+ Ok ( DocumentSymbolResponse :: Nested ( Vec :: new ( ) ) ) ,
945+ ) ) ;
946+ } else {
947+ let transaction =
948+ ide_transaction_manager. non_committable_transaction ( & self . state ) ;
949+ self . send_response ( new_response (
950+ x. id ,
951+ Ok ( DocumentSymbolResponse :: Nested (
952+ self . hierarchical_document_symbols ( & transaction, params)
953+ . unwrap_or_default ( ) ,
954+ ) ) ,
955+ ) ) ;
956+ ide_transaction_manager. save ( transaction) ;
957+ }
938958 }
939959 } else if let Some ( params) = as_request :: < WorkspaceSymbolRequest > ( & x) {
940960 if let Some ( params) = self
@@ -1688,6 +1708,22 @@ impl Server {
16881708 . map ( |( handle, _) | handle)
16891709 }
16901710
1711+ /// Check if a specific language service is disabled for the given URI
1712+ fn is_service_disabled ( & self , uri : & Url , service_check : impl Fn ( & DisabledLanguageServicesConfig ) -> bool ) -> bool {
1713+ let path = uri. to_file_path ( ) . unwrap ( ) ;
1714+ self . workspaces . get_with ( path, |( _, workspace) | {
1715+ // First check the global disable_language_services flag
1716+ if workspace. disable_language_services {
1717+ return true ;
1718+ }
1719+ // Then check if this specific service is disabled
1720+ if let Some ( disabled_services) = & workspace. disabled_language_services {
1721+ return service_check ( disabled_services) ;
1722+ }
1723+ false
1724+ } )
1725+ }
1726+
16911727 fn goto_definition (
16921728 & self ,
16931729 transaction : & Transaction < ' _ > ,
0 commit comments