mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Bundle TS 4.4
This commit is contained in:
parent
4897f96975
commit
637b409b00
|
@ -4,7 +4,7 @@
|
|||
"license": "MIT",
|
||||
"description": "Dependencies shared by all extensions",
|
||||
"dependencies": {
|
||||
"typescript": "4.3.5"
|
||||
"typescript": "^4.4.0-dev.20210728"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "node ./postinstall"
|
||||
|
|
|
@ -58,7 +58,7 @@ export function activate(
|
|||
new TypeScriptVersion(
|
||||
TypeScriptVersionSource.Bundled,
|
||||
vscode.Uri.joinPath(context.extensionUri, 'dist/browser/typescript/tsserver.web.js').toString(),
|
||||
API.fromSimpleString('4.3.5')));
|
||||
API.fromSimpleString('4.4.1')));
|
||||
|
||||
const lazyClientHost = createLazyClientHost(context, false, {
|
||||
pluginManager,
|
||||
|
|
|
@ -685,7 +685,6 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider<
|
|||
includeExternalModuleExports: completionConfiguration.autoImportSuggestions,
|
||||
includeInsertTextCompletions: true,
|
||||
triggerCharacter: this.getTsTriggerCharacter(context),
|
||||
// @ts-expect-error
|
||||
triggerKind: typeConverters.CompletionTriggerKind.toProtocolCompletionTriggerKind(context.triggerKind),
|
||||
};
|
||||
|
||||
|
|
|
@ -199,7 +199,6 @@ export default class FileConfigurationManager extends Disposable {
|
|||
generateReturnInDocTemplate: config.get<boolean>('suggest.jsdoc.generateReturns', true),
|
||||
includeCompletionsForImportStatements: config.get<boolean>('suggest.includeCompletionsForImportStatements', true),
|
||||
includeCompletionsWithSnippetText: config.get<boolean>('suggest.includeCompletionsWithSnippetText', true),
|
||||
// @ts-expect-error until 4.4
|
||||
allowIncompleteCompletions: true,
|
||||
displayPartsForJSDoc: true,
|
||||
...getInlayHintsPreferences(config),
|
||||
|
|
|
@ -4,82 +4,15 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as Proto from '../protocol';
|
||||
import { DocumentSelector } from '../utils/documentSelector';
|
||||
import { ClientCapability, ITypeScriptServiceClient, ServerResponse, ExecConfig } from '../typescriptService';
|
||||
import type * as Proto from '../protocol';
|
||||
import { ClientCapability, ITypeScriptServiceClient } from '../typescriptService';
|
||||
import API from '../utils/api';
|
||||
import { Condition, conditionalRegistration, requireMinVersion, requireSomeCapability } from '../utils/dependentRegistration';
|
||||
import { Disposable } from '../utils/dispose';
|
||||
import { DocumentSelector } from '../utils/documentSelector';
|
||||
import { Position } from '../utils/typeConverters';
|
||||
import FileConfigurationManager, { getInlayHintsPreferences, InlayHintSettingNames } from './fileConfigurationManager';
|
||||
import API from '../utils/api';
|
||||
import { Disposable } from '../utils/dispose';
|
||||
|
||||
namespace ExperimentalProto {
|
||||
export const enum CommandTypes {
|
||||
ProvideInlineHints = 'ProvideInlayHints'
|
||||
}
|
||||
|
||||
export interface InlayHintsArgs extends Proto.FileRequestArgs {
|
||||
/**
|
||||
* Start position of the span.
|
||||
*/
|
||||
start: number;
|
||||
/**
|
||||
* Length of the span.
|
||||
*/
|
||||
length: number;
|
||||
}
|
||||
|
||||
export interface InlineHintsRequest extends Proto.Request {
|
||||
command: CommandTypes.ProvideInlineHints;
|
||||
arguments: InlayHintsArgs;
|
||||
}
|
||||
|
||||
export enum InlayHintKind {
|
||||
Type = 'Type',
|
||||
Parameter = 'Parameter',
|
||||
Enum = 'Enum'
|
||||
}
|
||||
|
||||
interface InlayHintItem {
|
||||
text: string;
|
||||
position: Proto.Location;
|
||||
kind?: InlayHintKind;
|
||||
whitespaceBefore?: boolean;
|
||||
whitespaceAfter?: boolean;
|
||||
}
|
||||
|
||||
export interface InlayHintsResponse extends Proto.Response {
|
||||
body?: InlayHintItem[];
|
||||
}
|
||||
|
||||
export interface IExtendedTypeScriptServiceClient {
|
||||
execute<K extends keyof ExtendedTsServerRequests>(
|
||||
command: K,
|
||||
args: ExtendedTsServerRequests[K][0],
|
||||
token: vscode.CancellationToken,
|
||||
config?: ExecConfig
|
||||
): Promise<ServerResponse.Response<ExtendedTsServerRequests[K][1]>>;
|
||||
}
|
||||
|
||||
export interface ExtendedTsServerRequests {
|
||||
'provideInlayHints': [InlayHintsArgs, InlayHintsResponse];
|
||||
}
|
||||
|
||||
export namespace InlayHintKind {
|
||||
export function fromProtocolInlayHintKind(kind: InlayHintKind): vscode.InlayHintKind {
|
||||
switch (kind) {
|
||||
case InlayHintKind.Parameter:
|
||||
return vscode.InlayHintKind.Parameter;
|
||||
case InlayHintKind.Type:
|
||||
return vscode.InlayHintKind.Type;
|
||||
case InlayHintKind.Enum:
|
||||
return vscode.InlayHintKind.Other;
|
||||
default:
|
||||
return vscode.InlayHintKind.Other;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const inlayHintSettingNames = [
|
||||
InlayHintSettingNames.parameterNamesSuppressWhenArgumentMatchesName,
|
||||
|
@ -122,7 +55,7 @@ class TypeScriptInlayHintsProvider extends Disposable implements vscode.InlayHin
|
|||
|
||||
await this.fileConfigurationManager.ensureConfigurationForDocument(model, token);
|
||||
|
||||
const response = await (this.client as ExperimentalProto.IExtendedTypeScriptServiceClient).execute('provideInlayHints', { file: filepath, start, length }, token);
|
||||
const response = await this.client.execute('provideInlayHints', { file: filepath, start, length }, token);
|
||||
if (response.type !== 'response' || !response.success || !response.body) {
|
||||
return [];
|
||||
}
|
||||
|
@ -131,7 +64,7 @@ class TypeScriptInlayHintsProvider extends Disposable implements vscode.InlayHin
|
|||
const result = new vscode.InlayHint(
|
||||
hint.text,
|
||||
Position.fromLocation(hint.position),
|
||||
hint.kind && ExperimentalProto.InlayHintKind.fromProtocolInlayHintKind(hint.kind)
|
||||
hint.kind && fromProtocolInlayHintKind(hint.kind)
|
||||
);
|
||||
result.whitespaceBefore = hint.whitespaceBefore;
|
||||
result.whitespaceAfter = hint.whitespaceAfter;
|
||||
|
@ -140,6 +73,16 @@ class TypeScriptInlayHintsProvider extends Disposable implements vscode.InlayHin
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function fromProtocolInlayHintKind(kind: Proto.InlayHintKind): vscode.InlayHintKind {
|
||||
switch (kind) {
|
||||
case 'Parameter': return vscode.InlayHintKind.Parameter;
|
||||
case 'Type': return vscode.InlayHintKind.Type;
|
||||
case 'Enum': return vscode.InlayHintKind.Other;
|
||||
default: return vscode.InlayHintKind.Other;
|
||||
}
|
||||
}
|
||||
|
||||
export function requireInlayHintsConfiguration(
|
||||
language: string
|
||||
) {
|
||||
|
|
|
@ -69,6 +69,7 @@ interface StandardTsServerRequests {
|
|||
'provideCallHierarchyIncomingCalls': [Proto.FileLocationRequestArgs, Proto.ProvideCallHierarchyIncomingCallsResponse];
|
||||
'provideCallHierarchyOutgoingCalls': [Proto.FileLocationRequestArgs, Proto.ProvideCallHierarchyOutgoingCallsResponse];
|
||||
'fileReferences': [Proto.FileRequestArgs, Proto.FileReferencesResponse];
|
||||
'provideInlayHints': [Proto.InlayHintsRequestArgs, Proto.InlayHintsResponse];
|
||||
}
|
||||
|
||||
interface NoResponseTsServerRequests {
|
||||
|
|
|
@ -128,7 +128,6 @@ export namespace SymbolKind {
|
|||
}
|
||||
|
||||
export namespace CompletionTriggerKind {
|
||||
// @ts-expect-error until 4.4
|
||||
// TODO: once 4.4 protocol is available, replace number literals in return statements.
|
||||
export function toProtocolCompletionTriggerKind(kind: vscode.CompletionTriggerKind): Proto.CompletionTriggerKind {
|
||||
switch (kind) {
|
||||
|
|
|
@ -24,10 +24,10 @@ fast-plist@0.1.2:
|
|||
resolved "https://registry.yarnpkg.com/fast-plist/-/fast-plist-0.1.2.tgz#a45aff345196006d406ca6cdcd05f69051ef35b8"
|
||||
integrity sha1-pFr/NFGWAG1AbKbNzQX2kFHvNbg=
|
||||
|
||||
typescript@4.3.5:
|
||||
version "4.3.5"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
|
||||
integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==
|
||||
typescript@^4.4.0-dev.20210728:
|
||||
version "4.4.0-dev.20210728"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.0-dev.20210728.tgz#93595435d2f64d9da44e1d0fc0e8184132006023"
|
||||
integrity sha512-ZAbNY9MCH4O4gtolh/3+nsYgDxItqCGBIqERwaKLzjMDJDyvyiZZzcUHsU6DMo/44dAetm4LXZ26bf8hbryUew==
|
||||
|
||||
vscode-grammar-updater@^1.0.3:
|
||||
version "1.0.3"
|
||||
|
|
Loading…
Reference in a new issue