forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.ts
42 lines (39 loc) · 1.47 KB
/
common.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { LanguageServiceMode } from "./_namespaces/ts";
import {
Logger,
LogLevel,
ServerCancellationToken,
SessionOptions,
} from "./_namespaces/ts.server";
/** @internal */
export function getLogLevel(level: string | undefined) {
if (level) {
const l = level.toLowerCase();
for (const name in LogLevel) {
if (isNaN(+name) && l === name.toLowerCase()) {
return LogLevel[name] as any as LogLevel;
}
}
}
return undefined;
}
/** @internal */
export interface StartSessionOptions {
globalPlugins: SessionOptions["globalPlugins"];
pluginProbeLocations: SessionOptions["pluginProbeLocations"];
allowLocalPluginLoads: SessionOptions["allowLocalPluginLoads"];
useSingleInferredProject: SessionOptions["useSingleInferredProject"];
useInferredProjectPerProjectRoot: SessionOptions["useInferredProjectPerProjectRoot"];
suppressDiagnosticEvents: SessionOptions["suppressDiagnosticEvents"];
noGetErrOnBackgroundUpdate: SessionOptions["noGetErrOnBackgroundUpdate"];
serverMode: SessionOptions["serverMode"];
}
/** @internal */
export interface StartInput {
args: readonly string[];
logger: Logger;
cancellationToken: ServerCancellationToken;
serverMode: LanguageServiceMode | undefined;
unknownServerMode?: string;
startSession: (option: StartSessionOptions, logger: Logger, cancellationToken: ServerCancellationToken) => void;
}