Skip to content

Commit 8f11290

Browse files
committed
refactor: remove support for VE projects
1 parent a991afa commit 8f11290

File tree

9 files changed

+5
-137
lines changed

9 files changed

+5
-137
lines changed

.bazelignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
node_modules/
2-
v12_language_service/node_modules
32
dist/
43
integration/pre_apf_project/node_modules/
54
integration/project/node_modules/

BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ npm_package(
4141
"//client:index.js",
4242
"//server:npm_files",
4343
"//syntaxes:npm_files",
44-
"//v12_language_service:npm_files",
4544
# Transitive closure of npm deps needed for vsce; this set was determined manually by
4645
# running `bazel build //:vsix` and burning down missing packages. We do this so that we
4746
# don't have to run an additional `npm install` action to create a node_modules within the

WORKSPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ npm_translate_lock(
7575
npmrc = "//:.npmrc",
7676
data = [
7777
"//:pnpm-workspace.yaml",
78-
"//v12_language_service:package.json",
7978
# PLACE_HOLDER_FOR_angular/angular_packages/language-service/build.sh
8079
],
8180
verify_node_modules_ignored = "//:.bazelignore",

client/src/client.ts

Lines changed: 4 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -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');
@@ -471,31 +462,14 @@ function getServerOptions(ctx: vscode.ExtensionContext, debug: boolean): lsp.Nod
471462
// will return false even when the value is not set. If value is false, then
472463
// we need to check if all projects support Ivy language service.
473464
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-
}
488465

489466
// Node module for the language server
490-
const args = constructArgs(ctx, viewEngine, vscode.workspace.isTrusted);
467+
const args = constructArgs(ctx, vscode.workspace.isTrusted);
491468
const prodBundle = ctx.asAbsolutePath('server');
492469
const devBundle = ctx.asAbsolutePath(path.join('bazel-bin', 'server', 'src', 'server.js'));
493470
// VS Code Insider launches extensions in debug mode by default but users
494471
// install prod bundle so we have to check whether dev bundle exists.
495472
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;
499473

500474
// Argv options for Node.js
501475
const prodExecArgv: string[] = [];
@@ -507,7 +481,7 @@ function getServerOptions(ctx: vscode.ExtensionContext, debug: boolean): lsp.Nod
507481
];
508482

509483
return {
510-
module,
484+
module: latestServerModule,
511485
transport: lsp.TransportKind.ipc,
512486
args,
513487
options: {
@@ -516,29 +490,3 @@ function getServerOptions(ctx: vscode.ExtensionContext, debug: boolean): lsp.Nod
516490
},
517491
};
518492
}
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-
}

pnpm-workspace.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
packages:
2-
- v12_language_service

server/src/version_provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import url from 'url';
1313
import {NodeModule, resolve, Version} from '../../common/resolver';
1414

1515
const MIN_TS_VERSION = '4.8';
16-
const MIN_NG_VERSION = '13.0';
16+
const MIN_NG_VERSION = '15.0';
1717
const TSSERVERLIB = 'typescript/lib/tsserverlibrary';
1818

1919
/**

v12_language_service/BUILD.bazel

Lines changed: 0 additions & 16 deletions
This file was deleted.

v12_language_service/package.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

v12_language_service/yarn.lock

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)