@@ -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' ) ;
@@ -471,31 +462,14 @@ function getServerOptions(ctx: vscode.ExtensionContext, debug: boolean): lsp.Nod
471
462
// will return false even when the value is not set. If value is false, then
472
463
// we need to check if all projects support Ivy language service.
473
464
const config = vscode . workspace . getConfiguration ( ) ;
474
- let viewEngine : boolean = config . get ( 'angular.view-engine' ) || ! allProjectsSupportIvy ( ) ;
475
- if ( viewEngine && ! allProjectsSupportVE ( ) ) {
476
- viewEngine = false ;
477
- if ( config . get ( 'angular.view-engine' ) ) {
478
- vscode . window . showErrorMessage (
479
- `The legacy View Engine option is enabled but the workspace contains a version 13 Angular project.` +
480
- ` Legacy View Engine will be disabled since support for it was dropped in v13.` ,
481
- ) ;
482
- } else if ( ! allProjectsSupportIvy ( ) && ! allProjectsSupportVE ( ) ) {
483
- vscode . window . showErrorMessage (
484
- `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).` +
485
- `The extension will not work for the legacy project in this workspace.` ) ;
486
- }
487
- }
488
465
489
466
// Node module for the language server
490
- const args = constructArgs ( ctx , viewEngine , vscode . workspace . isTrusted ) ;
467
+ const args = constructArgs ( ctx , vscode . workspace . isTrusted ) ;
491
468
const prodBundle = ctx . asAbsolutePath ( 'server' ) ;
492
469
const devBundle = ctx . asAbsolutePath ( path . join ( 'bazel-bin' , 'server' , 'src' , 'server.js' ) ) ;
493
470
// VS Code Insider launches extensions in debug mode by default but users
494
471
// install prod bundle so we have to check whether dev bundle exists.
495
472
const latestServerModule = debug && fs . existsSync ( devBundle ) ? devBundle : prodBundle ;
496
- const v12ServerModule = ctx . asAbsolutePath (
497
- path . join ( 'v12_language_service' , 'node_modules' , '@angular' , 'language-server' ) ) ;
498
- const module = viewEngine ? v12ServerModule : latestServerModule ;
499
473
500
474
// Argv options for Node.js
501
475
const prodExecArgv : string [ ] = [ ] ;
@@ -507,7 +481,7 @@ function getServerOptions(ctx: vscode.ExtensionContext, debug: boolean): lsp.Nod
507
481
] ;
508
482
509
483
return {
510
- module,
484
+ module : latestServerModule ,
511
485
transport : lsp . TransportKind . ipc ,
512
486
args,
513
487
options : {
@@ -516,29 +490,3 @@ function getServerOptions(ctx: vscode.ExtensionContext, debug: boolean): lsp.Nod
516
490
} ,
517
491
} ;
518
492
}
519
-
520
- /**
521
- * Returns true if all projects in the workspace support Ivy LS, otherwise
522
- * return false.
523
- */
524
- function allProjectsSupportIvy ( ) {
525
- const workspaceFolders = vscode . workspace . workspaceFolders || [ ] ;
526
- for ( const workspaceFolder of workspaceFolders ) {
527
- const angularCore = resolve ( '@angular/core' , workspaceFolder . uri . fsPath ) ;
528
- if ( angularCore ?. version . greaterThanOrEqual ( new Version ( '9' ) ) === false ) {
529
- return false ;
530
- }
531
- }
532
- return true ;
533
- }
534
-
535
- function allProjectsSupportVE ( ) {
536
- const workspaceFolders = vscode . workspace . workspaceFolders || [ ] ;
537
- for ( const workspaceFolder of workspaceFolders ) {
538
- const angularCore = resolve ( '@angular/core' , workspaceFolder . uri . fsPath ) ;
539
- if ( angularCore ?. version . greaterThanOrEqual ( new Version ( '13' ) ) === true ) {
540
- return false ;
541
- }
542
- }
543
- return true ;
544
- }
0 commit comments