Skip to content

Commit

Permalink
Restore namespace files and pass through namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Mar 15, 2024
1 parent a4c977f commit 1e5fd9d
Show file tree
Hide file tree
Showing 7 changed files with 180 additions and 117 deletions.
2 changes: 2 additions & 0 deletions src/tsserver/_namespaces/ts.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import * as ts from "../../typescript/typescript";
export = ts.server;
40 changes: 24 additions & 16 deletions src/tsserver/common.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import * as ts from "./_namespaces/ts";
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 ts.server.LogLevel) {
for (const name in LogLevel) {
if (isNaN(+name) && l === name.toLowerCase()) {
return ts.server.LogLevel[name] as any as ts.server.LogLevel;
return LogLevel[name] as any as LogLevel;
}
}
}
Expand All @@ -15,23 +23,23 @@ export function getLogLevel(level: string | undefined) {

/** @internal */
export interface StartSessionOptions {
globalPlugins: ts.server.SessionOptions["globalPlugins"];
pluginProbeLocations: ts.server.SessionOptions["pluginProbeLocations"];
allowLocalPluginLoads: ts.server.SessionOptions["allowLocalPluginLoads"];
useSingleInferredProject: ts.server.SessionOptions["useSingleInferredProject"];
useInferredProjectPerProjectRoot: ts.server.SessionOptions["useInferredProjectPerProjectRoot"];
suppressDiagnosticEvents: ts.server.SessionOptions["suppressDiagnosticEvents"];
noGetErrOnBackgroundUpdate: ts.server.SessionOptions["noGetErrOnBackgroundUpdate"];
canUseWatchEvents: ts.server.SessionOptions["canUseWatchEvents"];
serverMode: ts.server.SessionOptions["serverMode"];
globalPlugins: SessionOptions["globalPlugins"];
pluginProbeLocations: SessionOptions["pluginProbeLocations"];
allowLocalPluginLoads: SessionOptions["allowLocalPluginLoads"];
useSingleInferredProject: SessionOptions["useSingleInferredProject"];
useInferredProjectPerProjectRoot: SessionOptions["useInferredProjectPerProjectRoot"];
suppressDiagnosticEvents: SessionOptions["suppressDiagnosticEvents"];
noGetErrOnBackgroundUpdate: SessionOptions["noGetErrOnBackgroundUpdate"];
canUseWatchEvents: SessionOptions["canUseWatchEvents"];
serverMode: SessionOptions["serverMode"];
}

/** @internal */
export interface StartInput {
args: readonly string[];
logger: ts.server.Logger;
cancellationToken: ts.server.ServerCancellationToken;
serverMode: ts.LanguageServiceMode | undefined;
logger: Logger;
cancellationToken: ServerCancellationToken;
serverMode: LanguageServiceMode | undefined;
unknownServerMode?: string;
startSession: (option: StartSessionOptions, logger: ts.server.Logger, cancellationToken: ts.server.ServerCancellationToken) => void;
startSession: (option: StartSessionOptions, logger: Logger, cancellationToken: ServerCancellationToken) => void;
}
Loading

0 comments on commit 1e5fd9d

Please sign in to comment.