mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-27 05:37:45 +00:00
Don't depend on typescript protocol.d.ts (#163365)
This commit is contained in:
@@ -521,7 +521,7 @@ class MyCompletionItem extends vscode.CompletionItem {
|
||||
}
|
||||
}
|
||||
|
||||
function getScriptKindDetails(tsEntry: protocol.CompletionEntry,): string | undefined {
|
||||
function getScriptKindDetails(tsEntry: Proto.CompletionEntry,): string | undefined {
|
||||
if (!tsEntry.kindModifiers || tsEntry.kind !== PConst.Kind.script) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
import * as Proto from 'typescript/lib/protocol';
|
||||
export = Proto;
|
||||
import * as ts from 'typescript/lib/tsserverlibrary';
|
||||
export = ts.server.protocol;
|
||||
|
||||
|
||||
declare enum ServerType {
|
||||
Syntax = 'syntax',
|
||||
Semantic = 'semantic',
|
||||
}
|
||||
declare module 'typescript/lib/protocol' {
|
||||
|
||||
interface Response {
|
||||
readonly _serverType?: ServerType;
|
||||
declare module 'typescript/lib/tsserverlibrary' {
|
||||
namespace server.protocol {
|
||||
type TextInsertion = ts.TextInsertion;
|
||||
type ScriptElementKind = ts.ScriptElementKind;
|
||||
|
||||
interface Response {
|
||||
readonly _serverType?: ServerType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as objects from '../utils/objects';
|
||||
import * as Proto from '../protocol';
|
||||
|
||||
export enum TsServerLogLevel {
|
||||
Off,
|
||||
@@ -112,7 +113,7 @@ export interface TypeScriptServiceConfiguration {
|
||||
readonly enableProjectDiagnostics: boolean;
|
||||
readonly maxTsServerMemory: number;
|
||||
readonly enablePromptUseWorkspaceTsdk: boolean;
|
||||
readonly watchOptions: protocol.WatchOptions | undefined;
|
||||
readonly watchOptions: Proto.WatchOptions | undefined;
|
||||
readonly includePackageJsonAutoImports: 'auto' | 'on' | 'off' | undefined;
|
||||
readonly enableTsServerTracing: boolean;
|
||||
}
|
||||
@@ -196,8 +197,8 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu
|
||||
return configuration.get<boolean>('typescript.tsserver.experimental.enableProjectDiagnostics', false);
|
||||
}
|
||||
|
||||
protected readWatchOptions(configuration: vscode.WorkspaceConfiguration): protocol.WatchOptions | undefined {
|
||||
return configuration.get<protocol.WatchOptions>('typescript.tsserver.watchOptions');
|
||||
protected readWatchOptions(configuration: vscode.WorkspaceConfiguration): Proto.WatchOptions | undefined {
|
||||
return configuration.get<Proto.WatchOptions>('typescript.tsserver.watchOptions');
|
||||
}
|
||||
|
||||
protected readIncludePackageJsonAutoImports(configuration: vscode.WorkspaceConfiguration): 'auto' | 'on' | 'off' | undefined {
|
||||
|
||||
@@ -163,7 +163,7 @@ export async function openProjectConfigForFile(
|
||||
return;
|
||||
}
|
||||
|
||||
let res: ServerResponse.Response<protocol.ProjectInfoResponse> | undefined;
|
||||
let res: ServerResponse.Response<Proto.ProjectInfoResponse> | undefined;
|
||||
try {
|
||||
res = await client.execute('projectInfo', { file, needFileNameList: false }, nulToken);
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user