2828//! [`await_notification`]: TestServer::await_notification
2929
3030mod initialize;
31+ mod inlay_hints;
3132mod publish_diagnostics;
3233mod pull_diagnostics;
3334
@@ -48,20 +49,21 @@ use lsp_types::notification::{
4849 Initialized , Notification ,
4950} ;
5051use lsp_types:: request:: {
51- DocumentDiagnosticRequest , HoverRequest , Initialize , Request , Shutdown , WorkspaceConfiguration ,
52- WorkspaceDiagnosticRequest ,
52+ DocumentDiagnosticRequest , HoverRequest , Initialize , InlayHintRequest , Request , Shutdown ,
53+ WorkspaceConfiguration , WorkspaceDiagnosticRequest ,
5354} ;
5455use lsp_types:: {
5556 ClientCapabilities , ConfigurationParams , DiagnosticClientCapabilities ,
5657 DidChangeTextDocumentParams , DidChangeWatchedFilesClientCapabilities ,
5758 DidChangeWatchedFilesParams , DidCloseTextDocumentParams , DidOpenTextDocumentParams ,
5859 DocumentDiagnosticParams , DocumentDiagnosticReportResult , FileEvent , Hover , HoverParams ,
59- InitializeParams , InitializeResult , InitializedParams , NumberOrString , PartialResultParams ,
60- Position , PreviousResultId , PublishDiagnosticsClientCapabilities ,
61- TextDocumentClientCapabilities , TextDocumentContentChangeEvent , TextDocumentIdentifier ,
62- TextDocumentItem , TextDocumentPositionParams , Url , VersionedTextDocumentIdentifier ,
63- WorkDoneProgressParams , WorkspaceClientCapabilities , WorkspaceDiagnosticParams ,
64- WorkspaceDiagnosticReportResult , WorkspaceFolder ,
60+ InitializeParams , InitializeResult , InitializedParams , InlayHint , InlayHintClientCapabilities ,
61+ InlayHintParams , NumberOrString , PartialResultParams , Position , PreviousResultId ,
62+ PublishDiagnosticsClientCapabilities , Range , TextDocumentClientCapabilities ,
63+ TextDocumentContentChangeEvent , TextDocumentIdentifier , TextDocumentItem ,
64+ TextDocumentPositionParams , Url , VersionedTextDocumentIdentifier , WorkDoneProgressParams ,
65+ WorkspaceClientCapabilities , WorkspaceDiagnosticParams , WorkspaceDiagnosticReportResult ,
66+ WorkspaceFolder ,
6567} ;
6668use ruff_db:: system:: { OsSystem , SystemPath , SystemPathBuf , TestSystem } ;
6769use rustc_hash:: FxHashMap ;
@@ -725,6 +727,23 @@ impl TestServer {
725727 let id = self . send_request :: < HoverRequest > ( params) ;
726728 self . await_response :: < HoverRequest > ( & id)
727729 }
730+
731+ /// Sends a `textDocument/inlayHint` request for the document at the given path and range.
732+ pub ( crate ) fn inlay_hints_request (
733+ & mut self ,
734+ path : impl AsRef < SystemPath > ,
735+ range : Range ,
736+ ) -> Result < Option < Vec < InlayHint > > > {
737+ let params = InlayHintParams {
738+ text_document : TextDocumentIdentifier {
739+ uri : self . file_uri ( path) ,
740+ } ,
741+ range,
742+ work_done_progress_params : WorkDoneProgressParams :: default ( ) ,
743+ } ;
744+ let id = self . send_request :: < InlayHintRequest > ( params) ;
745+ self . await_response :: < InlayHintRequest > ( & id)
746+ }
728747}
729748
730749impl fmt:: Debug for TestServer {
@@ -897,6 +916,19 @@ impl TestServerBuilder {
897916 self
898917 }
899918
919+ /// Enable or disable inlay hints capability
920+ pub ( crate ) fn enable_inlay_hints ( mut self , enabled : bool ) -> Self {
921+ self . client_capabilities
922+ . text_document
923+ . get_or_insert_default ( )
924+ . inlay_hint = if enabled {
925+ Some ( InlayHintClientCapabilities :: default ( ) )
926+ } else {
927+ None
928+ } ;
929+ self
930+ }
931+
900932 /// Enable or disable file watching capability
901933 #[ expect( dead_code) ]
902934 pub ( crate ) fn enable_did_change_watched_files ( mut self , enabled : bool ) -> Self {
0 commit comments