@@ -17414,3 +17414,51 @@ fn type_reference_import_meta() {
17414
17414
client. did_close_file ( & source) ;
17415
17415
}
17416
17416
}
17417
+
17418
+ #[ test]
17419
+ fn ambient_module_errors_suppressed ( ) {
17420
+ let context = TestContextBuilder :: new ( ) . use_temp_cwd ( ) . build ( ) ;
17421
+ let mut client = context. new_lsp_command ( ) . build ( ) ;
17422
+ let temp_dir = context. temp_dir ( ) . path ( ) ;
17423
+
17424
+ client. initialize_default ( ) ;
17425
+
17426
+ temp_dir. join ( "ambient.d.ts" ) . write (
17427
+ r#"
17428
+ declare module "$virtual/module" {
17429
+ export const foo: number;
17430
+ }
17431
+ declare module "*.fake" {
17432
+ const fake: string;
17433
+ export default fake;
17434
+ }
17435
+
17436
+ "# ,
17437
+ ) ;
17438
+ let source = source_file (
17439
+ temp_dir. join ( "index.ts" ) ,
17440
+ r#"
17441
+ /// <reference types="./ambient.d.ts"/>
17442
+ import { foo as _foo } from "$virtual/module";
17443
+ import _fake from "./not-real.fake";
17444
+ import _bad from "./not-real.bad";
17445
+ "# ,
17446
+ ) ;
17447
+ let diagnostics = client. did_open_file ( & source) ;
17448
+ assert_eq ! ( diagnostics. all( ) . len( ) , 1 ) ;
17449
+ assert_eq ! (
17450
+ json!( diagnostics. all( ) ) ,
17451
+ json!( [
17452
+ {
17453
+ "range" : source. range_of( "\" ./not-real.bad\" " ) ,
17454
+ "severity" : 1 ,
17455
+ "code" : "no-local" ,
17456
+ "source" : "deno" ,
17457
+ "message" : format!(
17458
+ "Unable to load a local module: {}\n Please check the file path." ,
17459
+ temp_dir. join( "./not-real.bad" ) . url_file( )
17460
+ )
17461
+ }
17462
+ ] )
17463
+ ) ;
17464
+ }
0 commit comments