@@ -386,6 +386,34 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
386
386
387
387
// A server is started up, and it is notified about Rust files.
388
388
let mut fake_rust_server = fake_rust_servers. next ( ) . await . unwrap ( ) ;
389
+ fake_rust_server
390
+ . request :: < lsp:: request:: RegisterCapability > ( lsp:: RegistrationParams {
391
+ registrations : vec ! [ lsp:: Registration {
392
+ id: Default :: default ( ) ,
393
+ method: "workspace/didChangeWatchedFiles" . to_string( ) ,
394
+ register_options: serde_json:: to_value(
395
+ lsp:: DidChangeWatchedFilesRegistrationOptions {
396
+ watchers: vec![
397
+ lsp:: FileSystemWatcher {
398
+ glob_pattern: lsp:: GlobPattern :: String (
399
+ "/the-root/Cargo.toml" . to_string( ) ,
400
+ ) ,
401
+ kind: None ,
402
+ } ,
403
+ lsp:: FileSystemWatcher {
404
+ glob_pattern: lsp:: GlobPattern :: String (
405
+ "/the-root/*.rs" . to_string( ) ,
406
+ ) ,
407
+ kind: None ,
408
+ } ,
409
+ ] ,
410
+ } ,
411
+ )
412
+ . ok( ) ,
413
+ } ] ,
414
+ } )
415
+ . await
416
+ . unwrap ( ) ;
389
417
assert_eq ! (
390
418
fake_rust_server
391
419
. receive_notification:: <lsp:: notification:: DidOpenTextDocument >( )
@@ -433,6 +461,24 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
433
461
434
462
// A json language server is started up and is only notified about the json buffer.
435
463
let mut fake_json_server = fake_json_servers. next ( ) . await . unwrap ( ) ;
464
+ fake_json_server
465
+ . request :: < lsp:: request:: RegisterCapability > ( lsp:: RegistrationParams {
466
+ registrations : vec ! [ lsp:: Registration {
467
+ id: Default :: default ( ) ,
468
+ method: "workspace/didChangeWatchedFiles" . to_string( ) ,
469
+ register_options: serde_json:: to_value(
470
+ lsp:: DidChangeWatchedFilesRegistrationOptions {
471
+ watchers: vec![ lsp:: FileSystemWatcher {
472
+ glob_pattern: lsp:: GlobPattern :: String ( "/the-root/*.json" . to_string( ) ) ,
473
+ kind: None ,
474
+ } ] ,
475
+ } ,
476
+ )
477
+ . ok( ) ,
478
+ } ] ,
479
+ } )
480
+ . await
481
+ . unwrap ( ) ;
436
482
assert_eq ! (
437
483
fake_json_server
438
484
. receive_notification:: <lsp:: notification:: DidOpenTextDocument >( )
@@ -483,7 +529,7 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
483
529
)
484
530
) ;
485
531
486
- // Save notifications are reported to all servers.
532
+ // Save notifications are reported only to servers that signed up for a given extension .
487
533
project
488
534
. update ( cx, |project, cx| project. save_buffer ( toml_buffer, cx) )
489
535
. await
@@ -495,13 +541,6 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
495
541
. text_document,
496
542
lsp:: TextDocumentIdentifier :: new( lsp:: Url :: from_file_path( "/the-root/Cargo.toml" ) . unwrap( ) )
497
543
) ;
498
- assert_eq ! (
499
- fake_json_server
500
- . receive_notification:: <lsp:: notification:: DidSaveTextDocument >( )
501
- . await
502
- . text_document,
503
- lsp:: TextDocumentIdentifier :: new( lsp:: Url :: from_file_path( "/the-root/Cargo.toml" ) . unwrap( ) )
504
- ) ;
505
544
506
545
// Renames are reported only to servers matching the buffer's language.
507
546
fs. rename (
0 commit comments