mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 11:49:38 +00:00
@@ -14,7 +14,7 @@ function isCancellationToken(value: any): value is vscode.CancellationToken {
|
||||
return value && typeof value.isCancellationRequested === 'boolean' && typeof value.onCancellationRequested === 'function';
|
||||
}
|
||||
|
||||
interface RequestArgs {
|
||||
export interface RequestArgs {
|
||||
readonly file?: unknown;
|
||||
readonly $traceId?: unknown;
|
||||
}
|
||||
|
||||
@@ -777,8 +777,7 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider<
|
||||
dotAccessorContext = { range, text };
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
const isIncomplete = !!response.body.isIncomplete || (response.metadata as any)?.isIncomplete;
|
||||
const isIncomplete = !!response.body.isIncomplete || !!(response.metadata as Record<string, unknown>)?.isIncomplete;
|
||||
const entries = response.body.entries;
|
||||
const metadata = response.metadata;
|
||||
const defaultCommitCharacters = Object.freeze(response.body.defaultCommitCharacters);
|
||||
|
||||
@@ -105,11 +105,9 @@ function toTsTriggerReason(context: vscode.SignatureHelpContext): Proto.Signatur
|
||||
case vscode.SignatureHelpTriggerKind.TriggerCharacter:
|
||||
if (context.triggerCharacter) {
|
||||
if (context.isRetrigger) {
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
return { kind: 'retrigger', triggerCharacter: context.triggerCharacter as any };
|
||||
return { kind: 'retrigger', triggerCharacter: context.triggerCharacter as Proto.SignatureHelpRetriggerCharacter };
|
||||
} else {
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
return { kind: 'characterTyped', triggerCharacter: context.triggerCharacter as any };
|
||||
return { kind: 'characterTyped', triggerCharacter: context.triggerCharacter as Proto.SignatureHelpTriggerCharacter };
|
||||
}
|
||||
} else {
|
||||
return { kind: 'invoked' };
|
||||
|
||||
@@ -168,7 +168,7 @@ class SyncedBuffer {
|
||||
) { }
|
||||
|
||||
public open(): void {
|
||||
const args: Proto.OpenRequestArgs = {
|
||||
const args: Proto.OpenRequestArgs & { plugins?: string[] } = {
|
||||
file: this.filepath,
|
||||
fileContent: this.document.getText(),
|
||||
projectRootPath: this.getProjectRootPath(this.document.uri),
|
||||
@@ -183,8 +183,7 @@ class SyncedBuffer {
|
||||
.filter(x => x.languages.indexOf(this.document.languageId) >= 0);
|
||||
|
||||
if (tsPluginsForDocument.length) {
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
(args as any).plugins = tsPluginsForDocument.map(plugin => plugin.name);
|
||||
args.plugins = tsPluginsForDocument.map(plugin => plugin.name);
|
||||
}
|
||||
|
||||
this.synchronizer.open(this.resource, args);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import { Cancellation } from '@vscode/sync-api-common/lib/common/messageCancellation';
|
||||
import * as vscode from 'vscode';
|
||||
import { RequestArgs } from '../commands/tsserverRequests';
|
||||
import { TypeScriptServiceConfiguration } from '../configuration/configuration';
|
||||
import { TelemetryReporter } from '../logging/telemetry';
|
||||
import Tracer from '../logging/tracer';
|
||||
@@ -15,11 +16,11 @@ import { ServerResponse, ServerType, TypeScriptRequests } from '../typescriptSer
|
||||
import { Disposable } from '../utils/dispose';
|
||||
import { isWebAndHasSharedArrayBuffers } from '../utils/platform';
|
||||
import { OngoingRequestCanceller } from './cancellation';
|
||||
import { NodeVersionManager } from './nodeManager';
|
||||
import type * as Proto from './protocol/protocol';
|
||||
import { EventName } from './protocol/protocol.const';
|
||||
import { TypeScriptVersionManager } from './versionManager';
|
||||
import { TypeScriptVersion } from './versionProvider';
|
||||
import { NodeVersionManager } from './nodeManager';
|
||||
|
||||
export enum ExecutionTarget {
|
||||
Semantic,
|
||||
@@ -283,8 +284,8 @@ export class SingleTsServer extends Disposable implements ITypeScriptServer {
|
||||
}
|
||||
|
||||
this._requestQueue.enqueue(requestInfo);
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
if (args && typeof (args as any).$traceId === 'string') {
|
||||
const traceId = (args as RequestArgs).$traceId;
|
||||
if (args && typeof traceId === 'string') {
|
||||
const queueLength = this._requestQueue.length - 1;
|
||||
const pendingResponses = this._pendingResponses.size;
|
||||
const data: { command: string; queueLength: number; pendingResponses: number; queuedCommands?: string[]; pendingCommands?: string[] } = {
|
||||
@@ -299,8 +300,7 @@ export class SingleTsServer extends Disposable implements ITypeScriptServer {
|
||||
data.pendingCommands = this.getPendingCommands();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
this._telemetryReporter.logTraceEvent('TSServer.enqueueRequest', (args as any).$traceId, JSON.stringify(data));
|
||||
this._telemetryReporter.logTraceEvent('TSServer.enqueueRequest', traceId, JSON.stringify(data));
|
||||
}
|
||||
this.sendNextRequests();
|
||||
|
||||
|
||||
@@ -10,8 +10,7 @@ export function isWeb(): boolean {
|
||||
}
|
||||
|
||||
export function isWebAndHasSharedArrayBuffers(): boolean {
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
return isWeb() && (globalThis as any)['crossOriginIsolated'];
|
||||
return isWeb() && globalThis['crossOriginIsolated'];
|
||||
}
|
||||
|
||||
export function supportsReadableByteStreams(): boolean {
|
||||
|
||||
Reference in New Issue
Block a user