mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-17 00:34:47 -05:00
* Remove webServer
First draft; I may move some things around to be more readable.
* Refactor moved code
1. Move StartSessionOptions to common next to where it's first used.
2. Inline single-use BaseLogger base class into its only child class,
Logger.
3. Start using direct imports, eg `import {} from './common'`. I hope
this is OK?!
* Fix lint
* move imports back to namespace import
* hereby tsserver: remove exportIsTsObject
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import {
|
|
Logger,
|
|
LogLevel,
|
|
ServerCancellationToken,
|
|
SessionOptions,
|
|
} from "./_namespaces/ts.server";
|
|
import { LanguageServiceMode } from "./_namespaces/ts";
|
|
|
|
/** @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"];
|
|
syntaxOnly: SessionOptions["syntaxOnly"];
|
|
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;
|
|
}
|