mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
@@ -25,10 +25,12 @@ import { CallbackMap } from './callbackMap';
|
|||||||
import { RequestItem, RequestQueue, RequestQueueingType } from './requestQueue';
|
import { RequestItem, RequestQueue, RequestQueueingType } from './requestQueue';
|
||||||
|
|
||||||
class TypeScriptServerError extends Error {
|
class TypeScriptServerError extends Error {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
version: TypeScriptVersion,
|
||||||
public readonly response: Proto.Response,
|
public readonly response: Proto.Response,
|
||||||
) {
|
) {
|
||||||
super(response.message);
|
super(`TypeScript Server Error (${version.versionString})\n${response.message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +51,7 @@ export class TypeScriptServerSpawner {
|
|||||||
): TypeScriptServer {
|
): TypeScriptServer {
|
||||||
const apiVersion = version.version || API.defaultVersion;
|
const apiVersion = version.version || API.defaultVersion;
|
||||||
|
|
||||||
const { args, cancellationPipeName, tsServerLogFile } = this.getTsServerArgs(configuration, version, pluginManager);
|
const { args, cancellationPipeName, tsServerLogFile } = this.getTsServerArgs(configuration, version, apiVersion, pluginManager);
|
||||||
|
|
||||||
if (TypeScriptServerSpawner.isLoggingEnabled(apiVersion, configuration)) {
|
if (TypeScriptServerSpawner.isLoggingEnabled(apiVersion, configuration)) {
|
||||||
if (tsServerLogFile) {
|
if (tsServerLogFile) {
|
||||||
@@ -63,7 +65,7 @@ export class TypeScriptServerSpawner {
|
|||||||
const childProcess = electron.fork(version.tsServerPath, args, this.getForkOptions());
|
const childProcess = electron.fork(version.tsServerPath, args, this.getForkOptions());
|
||||||
this._logger.info('Started TSServer');
|
this._logger.info('Started TSServer');
|
||||||
|
|
||||||
return new TypeScriptServer(childProcess, tsServerLogFile, cancellationPipeName, this._telemetryReporter, this._tracer);
|
return new TypeScriptServer(childProcess, tsServerLogFile, cancellationPipeName, version, this._telemetryReporter, this._tracer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getForkOptions() {
|
private getForkOptions() {
|
||||||
@@ -77,14 +79,13 @@ export class TypeScriptServerSpawner {
|
|||||||
private getTsServerArgs(
|
private getTsServerArgs(
|
||||||
configuration: TypeScriptServiceConfiguration,
|
configuration: TypeScriptServiceConfiguration,
|
||||||
currentVersion: TypeScriptVersion,
|
currentVersion: TypeScriptVersion,
|
||||||
|
apiVersion: API,
|
||||||
pluginManager: PluginManager,
|
pluginManager: PluginManager,
|
||||||
): { args: string[], cancellationPipeName: string | undefined, tsServerLogFile: string | undefined } {
|
): { args: string[], cancellationPipeName: string | undefined, tsServerLogFile: string | undefined } {
|
||||||
const args: string[] = [];
|
const args: string[] = [];
|
||||||
let cancellationPipeName: string | undefined;
|
let cancellationPipeName: string | undefined;
|
||||||
let tsServerLogFile: string | undefined;
|
let tsServerLogFile: string | undefined;
|
||||||
|
|
||||||
const apiVersion = currentVersion.version || API.defaultVersion;
|
|
||||||
|
|
||||||
if (apiVersion.gte(API.v206)) {
|
if (apiVersion.gte(API.v206)) {
|
||||||
if (apiVersion.gte(API.v250)) {
|
if (apiVersion.gte(API.v250)) {
|
||||||
args.push('--useInferredProjectPerProjectRoot');
|
args.push('--useInferredProjectPerProjectRoot');
|
||||||
@@ -184,6 +185,7 @@ export class TypeScriptServer extends Disposable {
|
|||||||
private readonly _childProcess: cp.ChildProcess,
|
private readonly _childProcess: cp.ChildProcess,
|
||||||
private readonly _tsServerLogFile: string | undefined,
|
private readonly _tsServerLogFile: string | undefined,
|
||||||
private readonly _cancellationPipeName: string | undefined,
|
private readonly _cancellationPipeName: string | undefined,
|
||||||
|
private readonly _version: TypeScriptVersion,
|
||||||
private readonly _telemetryReporter: TelemetryReporter,
|
private readonly _telemetryReporter: TelemetryReporter,
|
||||||
private readonly _tracer: Tracer,
|
private readonly _tracer: Tracer,
|
||||||
) {
|
) {
|
||||||
@@ -301,7 +303,7 @@ export class TypeScriptServer extends Disposable {
|
|||||||
// Special case where response itself is successful but there is not any data to return.
|
// Special case where response itself is successful but there is not any data to return.
|
||||||
callback.onSuccess(new NoContentResponse());
|
callback.onSuccess(new NoContentResponse());
|
||||||
} else {
|
} else {
|
||||||
callback.onError(new TypeScriptServerError(response));
|
callback.onError(new TypeScriptServerError(this._version, response));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user