MCPcopy Create free account
hub / github.com/angular/angular / main

Function main

vscode-ng-language-service/server/src/server.ts:25–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23import {resolveNgLangSvc, resolveTsServer} from './version_provider';
24
25function main() {
26 // Create a logger that logs to file. OK to emit verbose entries.
27 const logger = createLogger({
28 logFile: options.logFile,
29 logVerbosity: options.logVerbosity,
30 });
31
32 const ts = resolveTsServer(options.tsProbeLocations, options.tsdk);
33 const ng = resolveNgLangSvc(options.ngProbeLocations);
34
35 const isG3 = ts.resolvedPath.includes('/google3/');
36
37 // ServerHost provides native OS functionality
38 const host = new ServerHost(isG3, options.useClientSideFileWatcher ?? false);
39
40 // Establish a new server session that encapsulates lsp connection.
41 const session = new Session({
42 host,
43 logger,
44 // TypeScript allows only package names as plugin names.
45 ngPlugin: '@angular/language-service',
46 resolvedNgLsPath: ng.resolvedPath,
47 logToConsole: options.logToConsole,
48 includeAutomaticOptionalChainCompletions: options.includeAutomaticOptionalChainCompletions,
49 includeCompletionsWithSnippetText: options.includeCompletionsWithSnippetText,
50 includeCompletionsForModuleExports: options.includeCompletionsForModuleExports,
51 forceStrictTemplates: isG3 || options.forceStrictTemplates,
52 disableBlockSyntax: options.disableBlockSyntax,
53 disableLetSyntax: options.disableLetSyntax,
54 angularCoreVersion: options.angularCoreVersion ?? null,
55 suppressAngularDiagnosticCodes: options.suppressAngularDiagnosticCodes ?? null,
56 });
57
58 // Log initialization info
59 session.info(`Angular language server process ID: ${process.pid}`);
60 session.info(`Imported typescript/lib/tsserverlibrary is version ${tsServerVersion}.`);
61 session.info(`Using ${ng.name} v${ng.version} from ${ng.resolvedPath}`);
62 if (logger.loggingEnabled()) {
63 session.info(`Log file: ${logger.getLogFileName()}`);
64 } else {
65 session.info(`Logging is turned off. To enable, run command 'Open Angular server log'.`);
66 }
67 if (process.env.NG_DEBUG === 'true') {
68 session.info('Angular Language Service is running under DEBUG mode');
69 }
70
71 session.listen();
72}
73
74main();

Callers 1

server.tsFile · 0.70

Calls 7

infoMethod · 0.95
listenMethod · 0.95
createLoggerFunction · 0.90
resolveTsServerFunction · 0.90
resolveNgLangSvcFunction · 0.90
loggingEnabledMethod · 0.80
getLogFileNameMethod · 0.80

Tested by

no test coverage detected