mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
Extract ITypeScript server interface
This commit is contained in:
@@ -109,7 +109,7 @@ export class TypeScriptServerSpawner {
|
|||||||
version: TypeScriptVersion,
|
version: TypeScriptVersion,
|
||||||
configuration: TypeScriptServiceConfiguration,
|
configuration: TypeScriptServiceConfiguration,
|
||||||
pluginManager: PluginManager
|
pluginManager: PluginManager
|
||||||
): TypeScriptServer {
|
): ITypeScriptServer {
|
||||||
const apiVersion = version.version || API.defaultVersion;
|
const apiVersion = version.version || API.defaultVersion;
|
||||||
|
|
||||||
const { args, cancellationPipeName, tsServerLogFile } = this.getTsServerArgs(configuration, version, apiVersion, pluginManager);
|
const { args, cancellationPipeName, tsServerLogFile } = this.getTsServerArgs(configuration, version, apiVersion, pluginManager);
|
||||||
@@ -303,7 +303,24 @@ class ChildServerProcess implements ServerProcess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TypeScriptServer extends Disposable {
|
export interface ITypeScriptServer {
|
||||||
|
readonly onEvent: vscode.Event<Proto.Event>;
|
||||||
|
readonly onExit: vscode.Event<any>;
|
||||||
|
readonly onError: vscode.Event<any>;
|
||||||
|
readonly onReaderError: vscode.Event<Error>;
|
||||||
|
|
||||||
|
readonly tsServerLogFile: string | undefined;
|
||||||
|
|
||||||
|
kill(): void;
|
||||||
|
|
||||||
|
executeImpl(command: string, args: any, executeInfo: { isAsync: boolean, token?: vscode.CancellationToken, expectsResult: false, lowPriority?: boolean }): undefined;
|
||||||
|
executeImpl(command: string, args: any, executeInfo: { isAsync: boolean, token?: vscode.CancellationToken, expectsResult: boolean, lowPriority?: boolean }): Promise<ServerResponse.Response<Proto.Response>>;
|
||||||
|
executeImpl(command: string, args: any, executeInfo: { isAsync: boolean, token?: vscode.CancellationToken, expectsResult: boolean, lowPriority?: boolean }): Promise<ServerResponse.Response<Proto.Response>> | undefined;
|
||||||
|
|
||||||
|
dispose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TypeScriptServer extends Disposable implements ITypeScriptServer {
|
||||||
private readonly _reader: Reader<Proto.Response>;
|
private readonly _reader: Reader<Proto.Response>;
|
||||||
private readonly _requestQueue = new RequestQueue();
|
private readonly _requestQueue = new RequestQueue();
|
||||||
private readonly _callbacks = new CallbackMap<Proto.Response>();
|
private readonly _callbacks = new CallbackMap<Proto.Response>();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import * as nls from 'vscode-nls';
|
|||||||
import BufferSyncSupport from './features/bufferSyncSupport';
|
import BufferSyncSupport from './features/bufferSyncSupport';
|
||||||
import { DiagnosticKind, DiagnosticsManager } from './features/diagnostics';
|
import { DiagnosticKind, DiagnosticsManager } from './features/diagnostics';
|
||||||
import * as Proto from './protocol';
|
import * as Proto from './protocol';
|
||||||
import { TypeScriptServer, TypeScriptServerSpawner } from './tsServer/server';
|
import { ITypeScriptServer, TypeScriptServerSpawner } from './tsServer/server';
|
||||||
import { ITypeScriptServiceClient, ServerResponse } from './typescriptService';
|
import { ITypeScriptServiceClient, ServerResponse } from './typescriptService';
|
||||||
import API from './utils/api';
|
import API from './utils/api';
|
||||||
import { TsServerLogLevel, TypeScriptServiceConfiguration } from './utils/configuration';
|
import { TsServerLogLevel, TypeScriptServiceConfiguration } from './utils/configuration';
|
||||||
@@ -46,7 +46,7 @@ namespace ServerState {
|
|||||||
export class Running {
|
export class Running {
|
||||||
readonly type = Type.Running;
|
readonly type = Type.Running;
|
||||||
constructor(
|
constructor(
|
||||||
public readonly server: TypeScriptServer,
|
public readonly server: ITypeScriptServer,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API version obtained from the version picker after checking the corresponding path exists.
|
* API version obtained from the version picker after checking the corresponding path exists.
|
||||||
|
|||||||
Reference in New Issue
Block a user