Merge from vscode 2e5312cd61ff99c570299ecc122c52584265eda2

This commit is contained in:
ADS Merger
2020-04-23 02:50:35 +00:00
committed by Anthony Dresser
parent 3603f55d97
commit 7f1d8fc32f
659 changed files with 22709 additions and 12497 deletions

View File

@@ -21,7 +21,10 @@ declare module 'vscode' {
export interface AuthenticationSession {
id: string;
getAccessToken(): Thenable<string>;
accountName: string;
account: {
displayName: string;
id: string;
};
scopes: string[]
}
@@ -714,7 +717,43 @@ declare module 'vscode' {
//#endregion
//#region deprecated debug API
//#region debug: https://github.com/microsoft/vscode/issues/88230
/**
* VS Code can call the `provideDebugConfigurations` method of a `DebugConfigurationProvider` in two situations (aka 'scopes'):
* to provide the initial debug configurations for a newly created launch.json or to provide debug configurations dynamically based on context.
* A scope can be used when registering a `DebugConfigurationProvider` with #debug.registerDebugConfigurationProvider.
*/
export enum DebugConfigurationProviderScope {
/**
* The 'initial' scope is used to ask for debug configurations to be copied into a newly created launch.json.
*/
Initial = 1,
/**
* The 'dynamic' scope is used to ask for additional dynamic debug configurations to be presented to the user (in addition to the static configurations from the launch.json).
*/
Dynamic = 2
}
export namespace debug {
/**
* Register a [debug configuration provider](#DebugConfigurationProvider) for a specific debug type.
* The optional [scope](#DebugConfigurationProviderScope) argument can be used to bind the `provideDebugConfigurations` method of the provider to a specific context (aka scope).
* Currently two scopes are possible: with the value `Initial` (or if no scope argument is given) the `provideDebugConfigurations` method is used to find the initial debug configurations to be copied into a newly created launch.json.
* With a scope value `Dynamic` the `provideDebugConfigurations` method is used to dynamically determine debug configurations to be presented to the user in addition to the static configurations from the launch.json.
* Please note that the scope argument only applies to the `provideDebugConfigurations` method: so the `resolveDebugConfiguration` methods are not affected at all.
* Registering a single provider with resolve methods for different scopes, results in the same resolve methods called multiple times.
* More than one provider can be registered for the same type.
*
* @param type The debug type for which the provider is registered.
* @param provider The [debug configuration provider](#DebugConfigurationProvider) to register.
* @param scope The [scope](#DebugConfigurationProviderScope) for which the 'provideDebugConfiguration' method of the provider is registered.
* @return A [disposable](#Disposable) that unregisters this provider when being disposed.
*/
export function registerDebugConfigurationProvider(debugType: string, provider: DebugConfigurationProvider, scope?: DebugConfigurationProviderScope): Disposable;
}
// deprecated debug API
export interface DebugConfigurationProvider {
/**
@@ -822,21 +861,6 @@ declare module 'vscode' {
//#endregion
//#region Joao: SCM Input Box
/**
* Represents the input box in the Source Control viewlet.
*/
export interface SourceControlInputBox {
/**
* Controls whether the input box is visible (default is `true`).
*/
visible: boolean;
}
//#endregion
//#region Terminal data write event https://github.com/microsoft/vscode/issues/78502
export interface TerminalDataWriteEvent {
@@ -895,20 +919,29 @@ declare module 'vscode' {
//#endregion
//#region Terminal link handlers https://github.com/microsoft/vscode/issues/91606
export namespace window {
/**
* Register a [TerminalLinkHandler](#TerminalLinkHandler) that can be used to intercept and
* handle links that are activated within terminals.
* @param handler The link handler being registered.
* @return A disposable that unregisters the link handler.
*/
export function registerTerminalLinkHandler(handler: TerminalLinkHandler): Disposable;
}
/**
* Describes how to handle terminal links.
*/
export interface TerminalLinkHandler {
/**
* Handles a link that is activated within the terminal.
*
* @param terminal The terminal the link was activated on.
* @param link The text of the link activated.
* @return Whether the link was handled, if the link was handled this link will not be
* considered by any other extension or by the default built-in link handler.
*/
@@ -1185,98 +1218,143 @@ declare module 'vscode' {
//#region Custom editor https://github.com/microsoft/vscode/issues/77131
/**
* Implements the editing functionality of a custom editor.
* Represents a custom document used by a [`CustomEditorProvider`](#CustomEditorProvider).
*
* This delegate is how custom editors hook into standard VS Code operations such as save and undo. The delegate
* is also how custom editors notify VS Code that an edit has taken place.
*
* @param EditType Type of edits used for the documents this delegate handles.
* Custom documents are only used within a given `CustomEditorProvider`. The lifecycle of a `CustomDocument` is
* managed by VS Code. When no more references remain to a `CustomDocument`, it is disposed of.
*/
interface CustomEditorEditingDelegate<EditType = unknown> {
interface CustomDocument {
/**
* The associated uri for this document.
*/
readonly uri: Uri;
/**
* Dispose of the custom document.
*
* This is invoked by VS Code when there are no more references to a given `CustomDocument` (for example when
* all editors associated with the document have been closed.)
*/
dispose(): void;
}
/**
* Event triggered by extensions to signal to VS Code that an edit has occurred on an [`EditableCustomDocument`](#EditableCustomDocument).
*
* @see [`EditableCustomDocument.onDidChange`](#EditableCustomDocument.onDidChange).
*/
interface CustomDocumentEditEvent {
/**
* Undo the edit operation.
*
* This is invoked by VS Code when the user triggers an undo.
*/
undo(): Thenable<void> | void;
/**
* Redo the edit operation.
*
* This is invoked by VS Code when the user triggers a redo.
*/
redo(): Thenable<void> | void;
/**
* Display name describing the edit.
*
* This is shown in the UI to users.
*/
readonly label?: string;
}
/**
* Event triggered by extensions to signal to VS Code that the content of a [`EditableCustomDocument`](#EditableCustomDocument)
* has changed.
*
* @see [`EditableCustomDocument.onDidChange`](#EditableCustomDocument.onDidChange).
*/
interface CustomDocumentContentChangeEvent {
// marker interface
}
/**
* A backup for an [`EditableCustomDocument`](#EditableCustomDocument).
*/
interface CustomDocumentBackup {
/**
* Unique identifier for the backup.
*
* This id is passed back to your extension in `openCustomDocument` when opening a custom editor from a backup.
*/
readonly backupId: string;
/**
* Dispose of the current backup.
*
* This is called by VS Code when it is clear the current backup, such as when a new backup is made or when the
* file is saved.
*/
dispose(): void;
}
/**
* Represents an editable custom document used by a [`CustomEditorProvider`](#CustomEditorProvider).
*
* `EditableCustomDocument` is how custom editors hook into standard VS Code operations such as save and undo. The
* document is also how custom editors notify VS Code that an edit has taken place.
*/
interface EditableCustomDocument extends CustomDocument {
/**
* Save the resource for a custom editor.
*
* This method is invoked by VS Code when the user saves a custom editor. This can happen when the user
* triggers save while the custom editor is active, by commands such as `save all`, or by auto save if enabled.
*
* To implement `save`, the delegate must persist the custom editor. This usually means writing the
* To implement `save`, the implementer must persist the custom editor. This usually means writing the
* file data for the custom document to disk. After `save` completes, any associated editor instances will
* no longer be marked as dirty.
*
* @param document Document to save.
* @param cancellation Token that signals the save is no longer required (for example, if another save was triggered).
*
* @return Thenable signaling that saving has completed.
*/
save(document: CustomDocument<EditType>, cancellation: CancellationToken): Thenable<void>;
save(cancellation: CancellationToken): Thenable<void>;
/**
* Save the resource for a custom editor to a different location.
*
* This method is invoked by VS Code when the user triggers `save as` on a custom editor.
*
* To implement `saveAs`, the delegate must persist the custom editor to `targetResource`. The
* To implement `saveAs`, the implementer must persist the custom editor to `targetResource`. The
* existing editor will remain open after `saveAs` completes.
*
* @param document Document to save.
* @param targetResource Location to save to.
* @param cancellation Token that signals the save is no longer required.
*
* @return Thenable signaling that saving has completed.
*/
saveAs(document: CustomDocument<EditType>, targetResource: Uri, cancellation: CancellationToken): Thenable<void>;
saveAs(targetResource: Uri, cancellation: CancellationToken): Thenable<void>;
/**
* Signal that an edit has occurred inside a custom editor.
*
* This event must be fired by your extension whenever an edit happens in a custom editor. An edit can be
* anything from changing some text, to cropping an image, to reordering a list. Your extension is free to
* anything from changing some text, to cropping an image, to reordering a list. Your extension is free to
* define what an edit is and what data is stored on each edit.
*
* VS Code uses edits to determine if a custom editor is dirty or not. VS Code also passes the edit objects back
* to your extension when triggers undo, redo, or revert (using the `undoEdits`, `applyEdits`, and `revert`
* methods of `CustomEditorEditingDelegate`)
* Firing `onDidChange` causes VS Code to mark the editors as being dirty. This is cleared when the user either
* saves or reverts the file.
*
* Editors that support undo/redo must fire a `CustomDocumentEditEvent` whenever an edit happens. This allows
* users to undo and redo the edit using VS Code's standard VS Code keyboard shortcuts. VS Code will also mark
* the editor as no longer being dirty if the user undoes all edits to the last saved state.
*
* Editors that support editing but cannot use VS Code's standard undo/redo mechanism must fire a `CustomDocumentContentChangeEvent`.
* The only way for a user to clear the dirty state of an editor that does not support undo/redo is to either
* `save` or `revert` the file.
*
* An editor should only ever fire `CustomDocumentEditEvent` events, or only ever fire `CustomDocumentContentChangeEvent` events.
*/
readonly onDidEdit: Event<CustomDocumentEditEvent<EditType>>;
/**
* Apply a list of edits to a custom editor.
*
* This method is invoked by VS Code when the user triggers `redo` in a custom editor.
*
* To implement `applyEdits`, the delegate must make sure all editor instances (webviews) for `document`
* are updated to render the document's new state (that is, every webview must be updated to show the document
* after applying `edits` to it).
*
* Note that `applyEdits` not invoked when `onDidEdit` is fired by your extension because `onDidEdit` implies
* that your extension has also updated its editor instances (webviews) to reflect the edit that just occurred.
*
* @param document Document to apply edits to.
* @param redoneEdits Array of edits that were redone. Sorted from oldest to most recent. Use [`document.appliedEdits`](#CustomDocument.appliedEdits)
* to get the full set of edits applied to the file (when `applyEdits` is called `appliedEdits` will already include
* the newly applied edit at the end).
*
* @return Thenable signaling that the change has completed.
*/
applyEdits(document: CustomDocument<EditType>, redoneEdits: ReadonlyArray<EditType>): Thenable<void>;
/**
* Undo a list of edits to a custom editor.
*
* This method is invoked by VS Code when the user triggers `undo` in a custom editor.
*
* To implement `undoEdits`, the delegate must make sure all editor instances (webviews) for `document`
* are updated to render the document's new state (that is, every webview must be updated to show the document
* after undoing `edits` from it).
*
* @param document Document to undo edits from.
* @param undoneEdits Array of undone edits. Sorted from most recent to oldest. Use [`document.appliedEdits`](#CustomDocument.appliedEdits)
* to get the full set of edits applied to the file (when `undoEdits` is called, `appliedEdits` will already include
* have the undone edits removed).
*
* @return Thenable signaling that the change has completed.
*/
undoEdits(document: CustomDocument<EditType>, undoneEdits: ReadonlyArray<EditType>): Thenable<void>;
readonly onDidChange: Event<CustomDocumentEditEvent> | Event<CustomDocumentContentChangeEvent>;
/**
* Revert a custom editor to its last saved state.
@@ -1284,21 +1362,18 @@ declare module 'vscode' {
* This method is invoked by VS Code when the user triggers `File: Revert File` in a custom editor. (Note that
* this is only used using VS Code's `File: Revert File` command and not on a `git revert` of the file).
*
* To implement `revert`, the delegate must make sure all editor instances (webviews) for `document`
* To implement `revert`, the implementer must make sure all editor instances (webviews) for `document`
* are displaying the document in the same state is saved in. This usually means reloading the file from the
* workspace.
*
* During `revert`, your extension should also clear any backups for the custom editor. Backups are only needed
* when there is a difference between an editor's state in VS Code and its save state on disk.
*
* @param document Document to revert.
* @param revert Object with added or removed edits to get back to the saved state. Use [`document.appliedEdits`](#CustomDocument.appliedEdits)
* to get the full set of edits applied to the file (when `revet` is called, `appliedEdits` will already have
* removed any edits undone by the revert and added any edits applied by the revert).
* @param cancellation Token that signals the revert is no longer required.
*
* @return Thenable signaling that the change has completed.
*/
revert(document: CustomDocument<EditType>, revert: CustomDocumentRevert<EditType>): Thenable<void>;
revert(cancellation: CancellationToken): Thenable<void>;
/**
* Back up the resource in its current state.
@@ -1313,129 +1388,25 @@ declare module 'vscode' {
* made in quick succession, `backup` is only triggered after the last one. `backup` is not invoked when
* `auto save` is enabled (since auto save already persists resource ).
*
* @param document Document to backup.
* @param cancellation Token that signals the current backup since a new backup is coming in. It is up to your
* extension to decided how to respond to cancellation. If for example your extension is backing up a large file
* in an operation that takes time to complete, your extension may decide to finish the ongoing backup rather
* than cancelling it to ensure that VS Code has some valid backup.
*/
backup(document: CustomDocument<EditType>, cancellation: CancellationToken): Thenable<void>;
backup(cancellation: CancellationToken): Thenable<CustomDocumentBackup>;
}
/**
* Event triggered by extensions to signal to VS Code that an edit has occurred on a `CustomDocument`.
*
* @param EditType Type of edits used for the document.
* Additional information about the opening custom document.
*/
interface CustomDocumentEditEvent<EditType = unknown> {
interface OpenCustomDocumentContext {
/**
* Document the edit is for.
*/
readonly document: CustomDocument<EditType>;
/**
* Object that describes the edit.
* The id of the backup to restore the document from or `undefined` if there is no backup.
*
* Edit objects are controlled entirely by your extension. Your extension should store whatever information it
* needs to on the edit to understand what type of edit was made, how to render that edit, and how to save that
* edit to disk.
*
* Edit objects are passed back to your extension in `CustomEditorEditingDelegate.undoEdits`,
* `CustomEditorEditingDelegate.applyEdits`, and `CustomEditorEditingDelegate.revert`. They can also be accessed
* using [`CustomDocument.appliedEdits`](#CustomDocument.appliedEdits) and [`CustomDocument.savedEdits`](#CustomDocument.savedEdits).
* If this is provided, your extension should restore the editor from the backup instead of reading the file
* the user's workspace.
*/
readonly edit: EditType;
/**
* Display name describing the edit.
*/
readonly label?: string;
}
/**
* Delta for edits undone/redone while reverting for a `CustomDocument`.
*
* @param EditType Type of edits used for the document being reverted.
*/
interface CustomDocumentRevert<EditType = unknown> {
/**
* List of edits that were undone to get the document back to its on disk state.
*/
readonly undoneEdits: ReadonlyArray<EditType>;
/**
* List of edits that were reapplied to get the document back to its on disk state.
*/
readonly appliedEdits: ReadonlyArray<EditType>;
}
/**
* Represents a custom document used by a [`CustomEditorProvider`](#CustomEditorProvider).
*
* Custom documents are only used within a given `CustomEditorProvider`. The lifecycle of a `CustomDocument` is
* managed by VS Code. When no more references remain to a `CustomDocument`, it is disposed of.
*
* @param EditType Type of edits used in this document.
*/
class CustomDocument<EditType = unknown> {
/**
* @param uri The associated resource for this document.
*/
constructor(uri: Uri);
/**
* The associated uri for this document.
*/
readonly uri: Uri;
/**
* Is this document representing an untitled file which has never been saved yet.
*/
readonly isUntitled: boolean;
/**
* The version number of this document (it will strictly increase after each
* change, including undo/redo).
*/
readonly version: number;
/**
* `true` if there are unpersisted changes.
*/
readonly isDirty: boolean;
/**
* List of edits from document open to the document's current state.
*
* `appliedEdits` returns a copy of the edit stack at the current point in time. Your extension should always
* use `CustomDocument.appliedEdits` to check the edit stack instead of holding onto a reference to `appliedEdits`.
*/
readonly appliedEdits: ReadonlyArray<EditType>;
/**
* List of edits from document open to the document's last saved point.
*
* The save point will be behind `appliedEdits` if the user saves and then continues editing,
* or in front of the last entry in `appliedEdits` if the user saves and then hits undo.
*
* `savedEdits` returns a copy of the edit stack at the current point in time. Your extension should always
* use `CustomDocument.savedEdits` to check the edit stack instead of holding onto a reference to `savedEdits`.
*/
readonly savedEdits: ReadonlyArray<EditType>;
/**
* `true` if the document has been closed. A closed document isn't synchronized anymore
* and won't be reused when the same resource is opened again.
*/
readonly isClosed: boolean;
/**
* Event fired when there are no more references to the `CustomDocument`.
*
* This happens when all custom editors for the document have been closed. Once a `CustomDocument` is disposed,
* it will not be reused when the same resource is opened again.
*/
readonly onDidDispose: Event<void>;
readonly backupId?: string;
}
/**
@@ -1447,9 +1418,9 @@ declare module 'vscode' {
* You should use this type of custom editor when dealing with binary files or more complex scenarios. For simple
* text based documents, use [`CustomTextEditorProvider`](#CustomTextEditorProvider) instead.
*
* @param EditType Type of edits used by the editors of this provider.
* @param DocumentType Type of the custom document returned by this provider.
*/
export interface CustomEditorProvider<EditType = unknown> {
export interface CustomEditorProvider<DocumentType extends CustomDocument = CustomDocument> {
/**
* Create a new document for a given resource.
@@ -1460,11 +1431,12 @@ declare module 'vscode' {
* this point will trigger another call to `openCustomDocument`.
*
* @param uri Uri of the document to open.
* @param openContext Additional information about the opening custom document.
* @param token A cancellation token that indicates the result is no longer needed.
*
* @return The custom document.
*/
openCustomDocument(uri: Uri, token: CancellationToken): Thenable<CustomDocument<EditType>> | CustomDocument<EditType>;
openCustomDocument(uri: Uri, openContext: OpenCustomDocumentContext, token: CancellationToken): Thenable<DocumentType> | DocumentType;
/**
* Resolve a custom editor for a given resource.
@@ -1481,14 +1453,7 @@ declare module 'vscode' {
*
* @return Optional thenable indicating that the custom editor has been resolved.
*/
resolveCustomEditor(document: CustomDocument<EditType>, webviewPanel: WebviewPanel, token: CancellationToken): Thenable<void> | void;
/**
* Defines the editing capability of the provider.
*
* When not provided, editors for this provider are considered readonly.
*/
readonly editingDelegate?: CustomEditorEditingDelegate<EditType>;
resolveCustomEditor(document: DocumentType, webviewPanel: WebviewPanel, token: CancellationToken): Thenable<void> | void;
}
namespace window {
@@ -1500,6 +1465,19 @@ declare module 'vscode' {
provider: CustomEditorProvider,
options?: {
readonly webviewOptions?: WebviewPanelOptions;
/**
* Indicates that the provider allows multiple editor instances to be open at the same time for
* the same resource.
*
* If not set, VS Code only allows one editor instance to be open at a time for each resource. If the
* user tries to open a second editor instance for the resource, the first one is instead moved to where
* the second one was to be opened.
*
* When set, users can split and create copies of the custom editor. The custom editor must make sure it
* can properly synchronize the states of all editor instances for a resource so that they are consistent.
*/
readonly supportsMultipleEditorsPerResource?: boolean;
}
): Disposable;
}
@@ -1612,6 +1590,13 @@ declare module 'vscode' {
export type CellOutput = CellStreamOutput | CellErrorOutput | CellDisplayOutput;
export enum NotebookCellRunState {
Running = 1,
Idle = 2,
Success = 3,
Error = 4
}
export interface NotebookCellMetadata {
/**
* Controls if the content of a cell is editable or not.
@@ -1628,11 +1613,23 @@ declare module 'vscode' {
* The order in which this cell was executed.
*/
executionOrder?: number;
/**
* A status message to be shown in the cell's status bar
*/
statusMessage?: string;
/**
* The cell's current run state
*/
runState?: NotebookCellRunState;
}
export interface NotebookCell {
readonly uri: Uri;
readonly cellKind: CellKind;
readonly document: TextDocument;
// API remove `source` or doc it as shorthand for document.getText()
readonly source: string;
language: string;
outputs: CellOutput[];
@@ -1675,13 +1672,34 @@ declare module 'vscode' {
metadata: NotebookDocumentMetadata;
}
export interface NotebookConcatTextDocument {
isClosed: boolean;
dispose(): void;
onDidChange: Event<void>;
version: number;
getText(): string;
getText(range: Range): string;
offsetAt(position: Position): number;
positionAt(offset: number): Position;
locationAt(positionOrRange: Position | Range): Location;
positionAt(location: Location): Position;
}
export interface NotebookEditorCellEdit {
insert(index: number, content: string | string[], language: string, type: CellKind, outputs: CellOutput[], metadata: NotebookCellMetadata | undefined): void;
delete(index: number): void;
}
export interface NotebookEditor {
/**
* The document associated with this notebook editor.
*/
readonly document: NotebookDocument;
/**
* The primary selected cell on this notebook editor.
*/
readonly selection?: NotebookCell;
viewColumn?: ViewColumn;
/**
* Fired when the output hosting webview posts a message.
@@ -1743,49 +1761,22 @@ declare module 'vscode' {
export let activeNotebookDocument: NotebookDocument | undefined;
export let activeNotebookEditor: NotebookEditor | undefined;
// export const onDidChangeNotebookDocument: Event<NotebookDocumentChangeEvent>;
/**
* Create a document that is the concatenation of all notebook cells. By default all code-cells are included
* but a selector can be provided to narrow to down the set of cells.
*
* @param notebook
* @param selector
*/
export function createConcatTextDocument(notebook: NotebookDocument, selector?: DocumentSelector): NotebookConcatTextDocument;
}
//#endregion
//#region color theme access
/**
* Represents a color theme kind.
*/
export enum ColorThemeKind {
Light = 1,
Dark = 2,
HighContrast = 3
}
/**
* Represents a color theme.
*/
export interface ColorTheme {
/**
* The kind of this color theme: light, dark or high contrast.
*/
readonly kind: ColorThemeKind;
}
export namespace window {
/**
* The currently active color theme as configured in the settings. The active
* theme can be changed via the `workbench.colorTheme` setting.
*/
export let activeColorTheme: ColorTheme;
/**
* An [event](#Event) which fires when the active theme changes or one of it's colors chnage.
*/
export const onDidChangeActiveColorTheme: Event<ColorTheme>;
}
//#endregion
//#region https://github.com/microsoft/vscode/issues/39441
export interface CompletionItem {
@@ -2028,66 +2019,4 @@ declare module 'vscode' {
//#endregion
//#region https://github.com/microsoft/vscode/issues/90208
export interface ExtensionContext {
/**
* @deprecated THIS API PROPOSAL WILL BE DROPPED
*/
asExtensionUri(relativePath: string): Uri;
/**
* The uri of the directory containing the extension.
*/
readonly extensionUri: Uri;
}
export interface Extension<T> {
/**
* @deprecated THIS API PROPOSAL WILL BE DROPPED
*/
asExtensionUri(relativePath: string): Uri;
/**
* The uri of the directory containing the extension.
*/
readonly extensionUri: Uri;
}
export namespace Uri {
/**
* Create a new uri which path is the result of joining
* the path of the base uri with the provided path segments.
*
* - Note 1: `joinPath` only affects the path component
* and all other components (scheme, authority, query, and fragment) are
* left as they are.
* - Note 2: The base uri must have a path; an error is thrown otherwise.
*
* The path segments are normalized in the following ways:
* - sequences of path separators (`/` or `\`) are replaced with a single separator
* - for `file`-uris on windows, the backslash-character (`\`) is considered a path-separator
* - the `..`-segment denotes the parent segment, the `.` denotes the current segement
* - paths have a root which always remains, for instance on windows drive-letters are roots
* so that is true: `joinPath(Uri.file('file:///c:/root'), '../../other').fsPath === 'c:/other'`
*
* @param base An uri. Must have a path.
* @param pathSegments One more more path fragments
* @returns A new uri which path is joined with the given fragments
*/
export function joinPath(base: Uri, ...pathSegments: string[]): Uri;
}
//#endregion
//#region https://github.com/microsoft/vscode/issues/91541
export enum CompletionItemKind {
User = 25,
Issue = 26,
}
//#endregion
}