in client/src/client.ts [457:513]
function getServerOptions(ctx: vscode.ExtensionContext, debug: boolean): lsp.NodeModule {
// Environment variables for server process
const prodEnv = {};
const devEnv = {
...prodEnv,
NG_DEBUG: true,
};
// Because the configuration is typed as "boolean" in package.json, vscode
// will return false even when the value is not set. If value is false, then
// we need to check if all projects support Ivy language service.
const config = vscode.workspace.getConfiguration();
let viewEngine: boolean = config.get('angular.view-engine') || !allProjectsSupportIvy();
if (viewEngine && !allProjectsSupportVE()) {
viewEngine = false;
if (config.get('angular.view-engine')) {
vscode.window.showErrorMessage(
`The legacy View Engine option is enabled but the workspace contains a version 13 Angular project.` +
` Legacy View Engine will be disabled since support for it was dropped in v13.`,
);
} else if (!allProjectsSupportIvy() && !allProjectsSupportVE()) {
vscode.window.showErrorMessage(
`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).` +
`The extension will not work for the legacy project in this workspace.`);
}
}
// Node module for the language server
const args = constructArgs(ctx, viewEngine);
const prodBundle = ctx.asAbsolutePath('server');
const devBundle = ctx.asAbsolutePath(path.join('dist', 'server', 'server.js'));
// VS Code Insider launches extensions in debug mode by default but users
// install prod bundle so we have to check whether dev bundle exists.
const latestServerModule = debug && fs.existsSync(devBundle) ? devBundle : prodBundle;
const v12ServerModule = ctx.asAbsolutePath(
path.join('v12_language_service', 'node_modules', '@angular', 'language-server'));
const module = viewEngine ? v12ServerModule : latestServerModule;
// Argv options for Node.js
const prodExecArgv: string[] = [];
const devExecArgv: string[] = [
// do not lazily evaluate the code so all breakpoints are respected
'--nolazy',
// If debugging port is changed, update .vscode/launch.json as well
'--inspect=6009',
];
return {
module,
transport: lsp.TransportKind.ipc,
args,
options: {
env: debug ? devEnv : prodEnv,
execArgv: debug ? devExecArgv : prodExecArgv,
},
};
}