@@ -402,8 +402,7 @@ function getProbeLocations(bundled: string): string[] {
402402 * Construct the arguments that's used to spawn the server process.
403403 * @param ctx vscode extension context
404404 */
405- function constructArgs (
406- ctx : vscode . ExtensionContext , viewEngine : boolean , isTrustedWorkspace : boolean ) : string [ ] {
405+ function constructArgs ( ctx : vscode . ExtensionContext , isTrustedWorkspace : boolean ) : string [ ] {
407406 const config = vscode . workspace . getConfiguration ( ) ;
408407 const args : string [ ] = [ '--logToConsole' ] ;
409408
@@ -416,15 +415,7 @@ function constructArgs(
416415 }
417416
418417 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 ( ',' ) ) ;
428419
429420 const includeAutomaticOptionalChainCompletions =
430421 config . get < boolean > ( 'angular.suggest.includeAutomaticOptionalChainCompletions' ) ;
@@ -462,31 +453,14 @@ function getServerOptions(ctx: vscode.ExtensionContext, debug: boolean): lsp.Nod
462453 // will return false even when the value is not set. If value is false, then
463454 // we need to check if all projects support Ivy language service.
464455 const config = vscode . workspace . getConfiguration ( ) ;
465- let viewEngine : boolean = config . get ( 'angular.view-engine' ) || ! allProjectsSupportIvy ( ) ;
466- if ( viewEngine && ! allProjectsSupportVE ( ) ) {
467- viewEngine = false ;
468- if ( config . get ( 'angular.view-engine' ) ) {
469- vscode . window . showErrorMessage (
470- `The legacy View Engine option is enabled but the workspace contains a version 13 Angular project.` +
471- ` Legacy View Engine will be disabled since support for it was dropped in v13.` ,
472- ) ;
473- } else if ( ! allProjectsSupportIvy ( ) && ! allProjectsSupportVE ( ) ) {
474- vscode . window . showErrorMessage (
475- `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).` +
476- `The extension will not work for the legacy project in this workspace.` ) ;
477- }
478- }
479456
480457 // Node module for the language server
481- const args = constructArgs ( ctx , viewEngine , vscode . workspace . isTrusted ) ;
458+ const args = constructArgs ( ctx , vscode . workspace . isTrusted ) ;
482459 const prodBundle = ctx . asAbsolutePath ( 'server' ) ;
483460 const devBundle = ctx . asAbsolutePath ( path . join ( 'bazel-bin' , 'server' , 'src' , 'server.js' ) ) ;
484461 // VS Code Insider launches extensions in debug mode by default but users
485462 // install prod bundle so we have to check whether dev bundle exists.
486463 const latestServerModule = debug && fs . existsSync ( devBundle ) ? devBundle : prodBundle ;
487- const v12ServerModule = ctx . asAbsolutePath (
488- path . join ( 'v12_language_service' , 'node_modules' , '@angular' , 'language-server' ) ) ;
489- const module = viewEngine ? v12ServerModule : latestServerModule ;
490464
491465 // Argv options for Node.js
492466 const prodExecArgv : string [ ] = [ ] ;
@@ -498,7 +472,7 @@ function getServerOptions(ctx: vscode.ExtensionContext, debug: boolean): lsp.Nod
498472 ] ;
499473
500474 return {
501- module,
475+ module : latestServerModule ,
502476 transport : lsp . TransportKind . ipc ,
503477 args,
504478 options : {
@@ -507,29 +481,3 @@ function getServerOptions(ctx: vscode.ExtensionContext, debug: boolean): lsp.Nod
507481 } ,
508482 } ;
509483}
510-
511- /**
512- * Returns true if all projects in the workspace support Ivy LS, otherwise
513- * return false.
514- */
515- function allProjectsSupportIvy ( ) {
516- const workspaceFolders = vscode . workspace . workspaceFolders || [ ] ;
517- for ( const workspaceFolder of workspaceFolders ) {
518- const angularCore = resolve ( '@angular/core' , workspaceFolder . uri . fsPath ) ;
519- if ( angularCore ?. version . greaterThanOrEqual ( new Version ( '9' ) ) === false ) {
520- return false ;
521- }
522- }
523- return true ;
524- }
525-
526- function allProjectsSupportVE ( ) {
527- const workspaceFolders = vscode . workspace . workspaceFolders || [ ] ;
528- for ( const workspaceFolder of workspaceFolders ) {
529- const angularCore = resolve ( '@angular/core' , workspaceFolder . uri . fsPath ) ;
530- if ( angularCore ?. version . greaterThanOrEqual ( new Version ( '13' ) ) === true ) {
531- return false ;
532- }
533- }
534- return true ;
535- }
0 commit comments