@@ -402,8 +402,7 @@ function getProbeLocations(bundled: string): string[] {
402
402
* Construct the arguments that's used to spawn the server process.
403
403
* @param ctx vscode extension context
404
404
*/
405
- function constructArgs (
406
- ctx : vscode . ExtensionContext , viewEngine : boolean , isTrustedWorkspace : boolean ) : string [ ] {
405
+ function constructArgs ( ctx : vscode . ExtensionContext , isTrustedWorkspace : boolean ) : string [ ] {
407
406
const config = vscode . workspace . getConfiguration ( ) ;
408
407
const args : string [ ] = [ '--logToConsole' ] ;
409
408
@@ -416,15 +415,7 @@ function constructArgs(
416
415
}
417
416
418
417
const ngProbeLocations = getProbeLocations ( ctx . extensionPath ) ;
419
- if ( viewEngine ) {
420
- args . push ( '--viewEngine' ) ;
421
- args . push ( '--ngProbeLocations' , [
422
- path . join ( ctx . extensionPath , 'v12_language_service' ) ,
423
- ...ngProbeLocations ,
424
- ] . join ( ',' ) ) ;
425
- } else {
426
- args . push ( '--ngProbeLocations' , ngProbeLocations . join ( ',' ) ) ;
427
- }
418
+ args . push ( '--ngProbeLocations' , ngProbeLocations . join ( ',' ) ) ;
428
419
429
420
const includeAutomaticOptionalChainCompletions =
430
421
config . get < boolean > ( 'angular.suggest.includeAutomaticOptionalChainCompletions' ) ;
@@ -466,31 +457,14 @@ function getServerOptions(ctx: vscode.ExtensionContext, debug: boolean): lsp.Nod
466
457
// will return false even when the value is not set. If value is false, then
467
458
// we need to check if all projects support Ivy language service.
468
459
const config = vscode . workspace . getConfiguration ( ) ;
469
- let viewEngine : boolean = config . get ( 'angular.view-engine' ) || ! allProjectsSupportIvy ( ) ;
470
- if ( viewEngine && ! allProjectsSupportVE ( ) ) {
471
- viewEngine = false ;
472
- if ( config . get ( 'angular.view-engine' ) ) {
473
- vscode . window . showErrorMessage (
474
- `The legacy View Engine option is enabled but the workspace contains a version 13 Angular project.` +
475
- ` Legacy View Engine will be disabled since support for it was dropped in v13.` ,
476
- ) ;
477
- } else if ( ! allProjectsSupportIvy ( ) && ! allProjectsSupportVE ( ) ) {
478
- vscode . window . showErrorMessage (
479
- `The workspace contains a project that does not support legacy View Engine (Angular v13+) and a project that does not support the new current runtime (v8 and below).` +
480
- `The extension will not work for the legacy project in this workspace.` ) ;
481
- }
482
- }
483
460
484
461
// Node module for the language server
485
- const args = constructArgs ( ctx , viewEngine , vscode . workspace . isTrusted ) ;
462
+ const args = constructArgs ( ctx , vscode . workspace . isTrusted ) ;
486
463
const prodBundle = ctx . asAbsolutePath ( 'server' ) ;
487
464
const devBundle = ctx . asAbsolutePath ( path . join ( 'bazel-bin' , 'server' , 'src' , 'server.js' ) ) ;
488
465
// VS Code Insider launches extensions in debug mode by default but users
489
466
// install prod bundle so we have to check whether dev bundle exists.
490
467
const latestServerModule = debug && fs . existsSync ( devBundle ) ? devBundle : prodBundle ;
491
- const v12ServerModule = ctx . asAbsolutePath (
492
- path . join ( 'v12_language_service' , 'node_modules' , '@angular' , 'language-server' ) ) ;
493
- const module = viewEngine ? v12ServerModule : latestServerModule ;
494
468
495
469
// Argv options for Node.js
496
470
const prodExecArgv : string [ ] = [ ] ;
@@ -502,7 +476,7 @@ function getServerOptions(ctx: vscode.ExtensionContext, debug: boolean): lsp.Nod
502
476
] ;
503
477
504
478
return {
505
- module,
479
+ module : latestServerModule ,
506
480
transport : lsp . TransportKind . ipc ,
507
481
args,
508
482
options : {
@@ -511,29 +485,3 @@ function getServerOptions(ctx: vscode.ExtensionContext, debug: boolean): lsp.Nod
511
485
} ,
512
486
} ;
513
487
}
514
-
515
- /**
516
- * Returns true if all projects in the workspace support Ivy LS, otherwise
517
- * return false.
518
- */
519
- function allProjectsSupportIvy ( ) {
520
- const workspaceFolders = vscode . workspace . workspaceFolders || [ ] ;
521
- for ( const workspaceFolder of workspaceFolders ) {
522
- const angularCore = resolve ( '@angular/core' , workspaceFolder . uri . fsPath ) ;
523
- if ( angularCore ?. version . greaterThanOrEqual ( new Version ( '9' ) ) === false ) {
524
- return false ;
525
- }
526
- }
527
- return true ;
528
- }
529
-
530
- function allProjectsSupportVE ( ) {
531
- const workspaceFolders = vscode . workspace . workspaceFolders || [ ] ;
532
- for ( const workspaceFolder of workspaceFolders ) {
533
- const angularCore = resolve ( '@angular/core' , workspaceFolder . uri . fsPath ) ;
534
- if ( angularCore ?. version . greaterThanOrEqual ( new Version ( '13' ) ) === true ) {
535
- return false ;
536
- }
537
- }
538
- return true ;
539
- }
0 commit comments