mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
Don't check in vscode.d.ts files
These files get added during install so we don't want to commit them
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -8,3 +8,6 @@ tsconfig.lsif.json
|
||||
*.lsif
|
||||
*.db
|
||||
*.tsbuildinfo
|
||||
|
||||
# Don't check in API files. These should be pulled in during install
|
||||
vscode*.d.ts
|
||||
|
||||
20792
chat-model-provider-sample/vscode.d.ts
vendored
20792
chat-model-provider-sample/vscode.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -1,144 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare module 'vscode' {
|
||||
|
||||
|
||||
// @API extension ship a d.ts files for their options
|
||||
|
||||
// @API the LanguageModelChatProvider2 is an alternative that combines a source, like ollama etc, with
|
||||
// concrete models. The `provideLanguageModelChatData` would do the discovery and auth dances and later
|
||||
// the model data is passed to the concrete function for making a requested or counting token
|
||||
|
||||
|
||||
// TODO@API name scheme
|
||||
export interface LanguageModelChatRequestHandleOptions {
|
||||
|
||||
// initiator
|
||||
readonly extensionId: string;
|
||||
|
||||
/**
|
||||
* A set of options that control the behavior of the language model. These options are specific to the language model
|
||||
* and need to be looked up in the respective documentation.
|
||||
*/
|
||||
readonly modelOptions: { [name: string]: any };
|
||||
|
||||
/**
|
||||
* An optional list of tools that are available to the language model. These could be registered tools available via
|
||||
* {@link lm.tools}, or private tools that are just implemented within the calling extension.
|
||||
*
|
||||
* If the LLM requests to call one of these tools, it will return a {@link LanguageModelToolCallPart} in
|
||||
* {@link LanguageModelChatResponse.stream}. It's the caller's responsibility to invoke the tool. If it's a tool
|
||||
* registered in {@link lm.tools}, that means calling {@link lm.invokeTool}.
|
||||
*
|
||||
* Then, the tool result can be provided to the LLM by creating an Assistant-type {@link LanguageModelChatMessage} with a
|
||||
* {@link LanguageModelToolCallPart}, followed by a User-type message with a {@link LanguageModelToolResultPart}.
|
||||
*/
|
||||
tools?: LanguageModelChatTool[];
|
||||
|
||||
/**
|
||||
* The tool-selecting mode to use. {@link LanguageModelChatToolMode.Auto} by default.
|
||||
*/
|
||||
toolMode?: LanguageModelChatToolMode;
|
||||
}
|
||||
|
||||
// TODO@API names: LanguageModelChatMetadata, LanguageModelChatItem
|
||||
export interface LanguageModelChatInformation {
|
||||
|
||||
readonly id: string;
|
||||
|
||||
/**
|
||||
* Human-readable name of the language model.
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* Opaque family-name of the language model. Values might be `gpt-3.5-turbo`, `gpt4`, `phi2`, or `llama`
|
||||
* but they are defined by extensions contributing languages and subject to change.
|
||||
*/
|
||||
readonly family: string;
|
||||
|
||||
/**
|
||||
* An optional, human-readable description of the language model.
|
||||
*/
|
||||
readonly description?: string;
|
||||
|
||||
/**
|
||||
* An optional, human-readable string representing the cost of using the language model.
|
||||
*/
|
||||
readonly cost?: string;
|
||||
|
||||
/**
|
||||
* Opaque version string of the model. This is defined by the extension contributing the language model
|
||||
* and subject to change while the identifier is stable.
|
||||
*/
|
||||
readonly version: string;
|
||||
|
||||
readonly maxInputTokens: number;
|
||||
|
||||
readonly maxOutputTokens: number;
|
||||
|
||||
/**
|
||||
* When present, this gates the use of `requestLanguageModelAccess` behind an authorization flow where
|
||||
* the user must approve of another extension accessing the models contributed by this extension.
|
||||
* Additionally, the extension can provide a label that will be shown in the UI.
|
||||
*/
|
||||
auth?: true | { label: string };
|
||||
|
||||
// TODO@API maybe an enum, LanguageModelChatProviderPickerAvailability?
|
||||
// TODO@API isPreselected proposed
|
||||
readonly isDefault?: boolean;
|
||||
|
||||
// TODO@API nuke
|
||||
readonly isUserSelectable?: boolean;
|
||||
|
||||
readonly capabilities?: {
|
||||
|
||||
// TODO@API have mimeTypes that you support
|
||||
readonly vision?: boolean;
|
||||
|
||||
// TODO@API should be `boolean | number` so extensions can express how many tools they support
|
||||
readonly toolCalling?: boolean | number;
|
||||
|
||||
// TODO@API DO NOT SUPPORT THIS
|
||||
// readonly agentMode?: boolean;
|
||||
|
||||
// TODO@API support prompt TSX style messages, MAYBE leave it out for now
|
||||
readonly promptTsx?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Optional category to group models by in the model picker.
|
||||
* The lower the order, the higher the category appears in the list.
|
||||
* Has no effect if `isUserSelectable` is `false`.
|
||||
* If not specified, the model will appear in the "Other Models" category.
|
||||
*/
|
||||
readonly category?: { label: string; order: number };
|
||||
}
|
||||
|
||||
export interface LanguageModelChatProvider2<T extends LanguageModelChatInformation = LanguageModelChatInformation> {
|
||||
|
||||
// signals a change from the provider to the editor so that prepareLanguageModelChat is called again
|
||||
onDidChange?: Event<void>;
|
||||
|
||||
// NOT cacheable (between reloads)
|
||||
prepareLanguageModelChat(options: { silent: boolean }, token: CancellationToken): ProviderResult<T[]>;
|
||||
|
||||
provideLanguageModelChatResponse(model: T, messages: Array<LanguageModelChatMessage | LanguageModelChatMessage2>, options: LanguageModelChatRequestHandleOptions, progress: Progress<ChatResponseFragment2>, token: CancellationToken): Thenable<any>;
|
||||
|
||||
provideTokenCount(model: T, text: string | LanguageModelChatMessage | LanguageModelChatMessage2, token: CancellationToken): Thenable<number>;
|
||||
}
|
||||
|
||||
export namespace lm {
|
||||
|
||||
export function registerChatModelProvider(vendor: string, provider: LanguageModelChatProvider2): Disposable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export interface ChatResponseFragment2 {
|
||||
index: number;
|
||||
part: LanguageModelTextPart | LanguageModelToolCallPart | LanguageModelDataPart | LanguageModelThinkingPart;
|
||||
}
|
||||
}
|
||||
@ -1,189 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare module 'vscode' {
|
||||
|
||||
// https://github.com/microsoft/vscode/issues/124024 @hediet
|
||||
|
||||
export namespace languages {
|
||||
/**
|
||||
* Registers an inline completion provider.
|
||||
*
|
||||
* Multiple providers can be registered for a language. In that case providers are asked in
|
||||
* parallel and the results are merged. A failing provider (rejected promise or exception) will
|
||||
* not cause a failure of the whole operation.
|
||||
*
|
||||
* @param selector A selector that defines the documents this provider is applicable to.
|
||||
* @param provider An inline completion provider.
|
||||
* @param metadata Metadata about the provider.
|
||||
* @return A {@link Disposable} that unregisters this provider when being disposed.
|
||||
*/
|
||||
export function registerInlineCompletionItemProvider(selector: DocumentSelector, provider: InlineCompletionItemProvider, metadata: InlineCompletionItemProviderMetadata): Disposable;
|
||||
}
|
||||
|
||||
export interface InlineCompletionItem {
|
||||
/**
|
||||
* If set to `true`, unopened closing brackets are removed and unclosed opening brackets are closed.
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
completeBracketPairs?: boolean;
|
||||
|
||||
warning?: InlineCompletionWarning;
|
||||
|
||||
/** If set to `true`, this item is treated as inline edit. */
|
||||
isInlineEdit?: boolean;
|
||||
|
||||
/**
|
||||
* A range specifying when the edit can be shown based on the cursor position.
|
||||
* If the cursor is within this range, the inline edit can be displayed.
|
||||
*/
|
||||
showRange?: Range;
|
||||
|
||||
showInlineEditMenu?: boolean;
|
||||
|
||||
action?: Command;
|
||||
|
||||
displayLocation?: InlineCompletionDisplayLocation;
|
||||
}
|
||||
|
||||
export interface InlineCompletionDisplayLocation {
|
||||
range: Range;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface InlineCompletionWarning {
|
||||
message: MarkdownString | string;
|
||||
icon?: ThemeIcon;
|
||||
}
|
||||
|
||||
export interface InlineCompletionItemProviderMetadata {
|
||||
/**
|
||||
* Specifies a list of extension ids that this provider yields to if they return a result.
|
||||
* If some inline completion provider registered by such an extension returns a result, this provider is not asked.
|
||||
*/
|
||||
yieldTo?: string[];
|
||||
/**
|
||||
* Can override the extension id for the yieldTo mechanism. Used for testing, so that yieldTo can be tested within one extension.
|
||||
*/
|
||||
groupId?: string;
|
||||
|
||||
debounceDelayMs?: number;
|
||||
|
||||
displayName?: string;
|
||||
}
|
||||
|
||||
export interface InlineCompletionItemProvider {
|
||||
/**
|
||||
* @param completionItem The completion item that was shown.
|
||||
* @param updatedInsertText The actual insert text (after brackets were fixed).
|
||||
*/
|
||||
// eslint-disable-next-line local/vscode-dts-provider-naming
|
||||
handleDidShowCompletionItem?(completionItem: InlineCompletionItem, updatedInsertText: string): void;
|
||||
|
||||
/**
|
||||
* Is called when an inline completion item was accepted partially.
|
||||
* @param info Additional info for the partial accepted trigger.
|
||||
*/
|
||||
// eslint-disable-next-line local/vscode-dts-provider-naming
|
||||
handleDidPartiallyAcceptCompletionItem?(completionItem: InlineCompletionItem, info: PartialAcceptInfo): void;
|
||||
|
||||
/**
|
||||
* Is called when an inline completion item is no longer being used.
|
||||
* Provides a reason of why it is not used anymore.
|
||||
*/
|
||||
// eslint-disable-next-line local/vscode-dts-provider-naming
|
||||
handleEndOfLifetime?(completionItem: InlineCompletionItem, reason: InlineCompletionEndOfLifeReason): void;
|
||||
|
||||
/**
|
||||
* Is called when an inline completion list is no longer being used (same reference as the list returned by provideInlineEditsForRange).
|
||||
*/
|
||||
// eslint-disable-next-line local/vscode-dts-provider-naming
|
||||
handleListEndOfLifetime?(list: InlineCompletionList, reason: InlineCompletionsDisposeReason): void;
|
||||
|
||||
onDidChange?: Event<void>;
|
||||
|
||||
// #region Deprecated methods
|
||||
|
||||
/**
|
||||
* Is called when an inline completion item was accepted partially.
|
||||
* @param acceptedLength The length of the substring of the inline completion that was accepted already.
|
||||
* @deprecated Use `handleDidPartiallyAcceptCompletionItem` with `PartialAcceptInfo` instead.
|
||||
*/
|
||||
// eslint-disable-next-line local/vscode-dts-provider-naming
|
||||
handleDidPartiallyAcceptCompletionItem?(completionItem: InlineCompletionItem, acceptedLength: number): void;
|
||||
|
||||
/**
|
||||
* @param completionItem The completion item that was rejected.
|
||||
* @deprecated Use {@link handleEndOfLifetime} instead.
|
||||
*/
|
||||
// eslint-disable-next-line local/vscode-dts-provider-naming
|
||||
handleDidRejectCompletionItem?(completionItem: InlineCompletionItem): void;
|
||||
|
||||
// #endregion
|
||||
}
|
||||
|
||||
export enum InlineCompletionEndOfLifeReasonKind {
|
||||
Accepted = 0,
|
||||
Rejected = 1,
|
||||
Ignored = 2,
|
||||
}
|
||||
|
||||
export type InlineCompletionEndOfLifeReason = {
|
||||
kind: InlineCompletionEndOfLifeReasonKind.Accepted; // User did an explicit action to accept
|
||||
} | {
|
||||
kind: InlineCompletionEndOfLifeReasonKind.Rejected; // User did an explicit action to reject
|
||||
} | {
|
||||
kind: InlineCompletionEndOfLifeReasonKind.Ignored;
|
||||
supersededBy?: InlineCompletionItem;
|
||||
userTypingDisagreed: boolean;
|
||||
};
|
||||
|
||||
export enum InlineCompletionsDisposeReasonKind {
|
||||
Other = 0,
|
||||
Empty = 1,
|
||||
TokenCancellation = 2,
|
||||
LostRace = 3,
|
||||
NotTaken = 4,
|
||||
}
|
||||
|
||||
export type InlineCompletionsDisposeReason = { kind: InlineCompletionsDisposeReasonKind };
|
||||
|
||||
export interface InlineCompletionContext {
|
||||
readonly userPrompt?: string;
|
||||
|
||||
readonly requestUuid: string;
|
||||
|
||||
readonly requestIssuedDateTime: number;
|
||||
}
|
||||
|
||||
export interface PartialAcceptInfo {
|
||||
kind: PartialAcceptTriggerKind;
|
||||
/**
|
||||
* The length of the substring of the provided inline completion text that was accepted already.
|
||||
*/
|
||||
acceptedLength: number;
|
||||
}
|
||||
|
||||
export enum PartialAcceptTriggerKind {
|
||||
Unknown = 0,
|
||||
Word = 1,
|
||||
Line = 2,
|
||||
Suggest = 3,
|
||||
}
|
||||
|
||||
// When finalizing `commands`, make sure to add a corresponding constructor parameter.
|
||||
export interface InlineCompletionList {
|
||||
/**
|
||||
* A list of commands associated with the inline completions of this list.
|
||||
*/
|
||||
commands?: Array<Command | { command: Command; icon: ThemeIcon }>;
|
||||
|
||||
/**
|
||||
* When set and the user types a suggestion without deviating from it, the inline suggestion is not updated.
|
||||
* Defaults to false (might change).
|
||||
*/
|
||||
enableForwardStability?: boolean;
|
||||
}
|
||||
}
|
||||
20792
proposed-api-sample/vscode.d.ts
vendored
20792
proposed-api-sample/vscode.d.ts
vendored
File diff suppressed because it is too large
Load Diff
20792
telemetry-sample/vscode.d.ts
vendored
20792
telemetry-sample/vscode.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -1,32 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare module 'vscode' {
|
||||
|
||||
// https://github.com/microsoft/vscode/issues/78502
|
||||
//
|
||||
// This API is still proposed but we don't intent on promoting it to stable due to problems
|
||||
// around performance. See #145234 for a more likely API to get stabilized.
|
||||
|
||||
export interface TerminalDataWriteEvent {
|
||||
/**
|
||||
* The {@link Terminal} for which the data was written.
|
||||
*/
|
||||
readonly terminal: Terminal;
|
||||
/**
|
||||
* The data being written.
|
||||
*/
|
||||
readonly data: string;
|
||||
}
|
||||
|
||||
namespace window {
|
||||
/**
|
||||
* An event which fires when the terminal's child pseudo-device is written to (the shell).
|
||||
* In other words, this provides access to the raw data stream from the process running
|
||||
* within the terminal, including VT sequences.
|
||||
*/
|
||||
export const onDidWriteTerminalData: Event<TerminalDataWriteEvent>;
|
||||
}
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare module 'vscode' {
|
||||
|
||||
// https://github.com/microsoft/vscode/issues/55718
|
||||
|
||||
/**
|
||||
* An {@link Event} which fires when a {@link Terminal}'s dimensions change.
|
||||
*/
|
||||
export interface TerminalDimensionsChangeEvent {
|
||||
/**
|
||||
* The {@link Terminal} for which the dimensions have changed.
|
||||
*/
|
||||
readonly terminal: Terminal;
|
||||
/**
|
||||
* The new value for the {@link Terminal.dimensions terminal's dimensions}.
|
||||
*/
|
||||
readonly dimensions: TerminalDimensions;
|
||||
}
|
||||
|
||||
export namespace window {
|
||||
/**
|
||||
* An event which fires when the {@link Terminal.dimensions dimensions} of the terminal change.
|
||||
*/
|
||||
export const onDidChangeTerminalDimensions: Event<TerminalDimensionsChangeEvent>;
|
||||
}
|
||||
|
||||
export interface Terminal {
|
||||
/**
|
||||
* The current dimensions of the terminal. This will be `undefined` immediately after the
|
||||
* terminal is created as the dimensions are not known until shortly after the terminal is
|
||||
* created.
|
||||
*/
|
||||
readonly dimensions: TerminalDimensions | undefined;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user