Merge from vscode 27ada910e121e23a6d95ecca9cae595fb98ab568

This commit is contained in:
ADS Merger
2020-04-30 00:53:43 +00:00
parent 87e5239713
commit 93f35ca321
413 changed files with 7190 additions and 8756 deletions

View File

@@ -112,6 +112,9 @@ declare module 'vscode' {
* Get existing authentication sessions. Rejects if a provider with providerId is not
* registered, or if the user does not consent to sharing authentication information with
* the extension.
* @param providerId The id of the provider to use
* @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication
* provider
*/
export function getSessions(providerId: string, scopes: string[]): Thenable<readonly AuthenticationSession[]>;
@@ -119,9 +122,20 @@ declare module 'vscode' {
* Prompt a user to login to create a new authenticaiton session. Rejects if a provider with
* providerId is not registered, or if the user does not consent to sharing authentication
* information with the extension.
* @param providerId The id of the provider to use
* @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication
* provider
*/
export function login(providerId: string, scopes: string[]): Thenable<AuthenticationSession>;
/**
* Logout of a specific session.
* @param providerId The id of the provider to use
* @param sessionId The session id to remove
* provider
*/
export function logout(providerId: string, sessionId: string): Thenable<void>;
/**
* An [event](#Event) which fires when the array of sessions has changed, or data
* within a session has changed for a provider. Fires with the ids of the providers
@@ -720,17 +734,18 @@ declare module 'vscode' {
//#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.
* A DebugConfigurationProviderTriggerKind specifies when the `provideDebugConfigurations` method of a `DebugConfigurationProvider` is triggered.
* Currently there are two situations: to provide the initial debug configurations for a newly created launch.json or
* to provide dynamically generated debug configurations when the user asks for them through the UI (e.g. via the "Select and Start Debugging" command).
* A trigger kind is used when registering a `DebugConfigurationProvider` with #debug.registerDebugConfigurationProvider.
*/
export enum DebugConfigurationProviderScope {
export enum DebugConfigurationProviderTriggerKind {
/**
* The 'initial' scope is used to ask for debug configurations to be copied into a newly created launch.json.
* `DebugConfigurationProvider.provideDebugConfigurations` is called to provide the initial debug configurations for 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).
* `DebugConfigurationProvider.provideDebugConfigurations` is called to provide dynamically generated debug configurations when the user asks for them through the UI (e.g. via the "Select and Start Debugging" command).
*/
Dynamic = 2
}
@@ -738,19 +753,19 @@ declare module 'vscode' {
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.
* The optional [triggerKind](#DebugConfigurationProviderTriggerKind) can be used to specify when the `provideDebugConfigurations` method of the provider is triggered.
* Currently two trigger kinds are possible: with the value `Initial` (or if no trigger kind argument is given) the `provideDebugConfigurations` method is used to provide the initial debug configurations to be copied into a newly created launch.json.
* With the trigger kind `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 `triggerKind` 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 trigger kinds, 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.
* @param triggerKind The [trigger](#DebugConfigurationProviderTrigger) 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;
export function registerDebugConfigurationProvider(debugType: string, provider: DebugConfigurationProvider, triggerKind?: DebugConfigurationProviderTriggerKind): Disposable;
}
// deprecated debug API
@@ -983,6 +998,15 @@ declare module 'vscode' {
* A collection of mutations that an extension can apply to a process environment.
*/
export interface EnvironmentVariableCollection {
/**
* Whether the collection should be cached for the workspace and applied to the terminal
* across window reloads. When true the collection will be active immediately such when the
* window reloads. Additionally, this API will return the cached version if it exists. The
* collection will be invalidated when the extension is uninstalled or when the collection
* is cleared. Defaults to true.
*/
persistent: boolean;
/**
* Replace an environment variable with a value.
*
@@ -1026,26 +1050,14 @@ declare module 'vscode' {
* Clears all mutators from this collection.
*/
clear(): void;
/**
* Disposes the collection, if the collection was persisted it will no longer be retained
* across reloads.
*/
dispose(): void;
}
export namespace window {
export interface ExtensionContext {
/**
* Creates or returns the extension's environment variable collection for this workspace,
* enabling changes to be applied to terminal environment variables.
*
* @param persistent Whether the collection should be cached for the workspace and applied
* to the terminal across window reloads. When true the collection will be active
* immediately such when the window reloads. Additionally, this API will return the cached
* version if it exists. The collection will be invalidated when the extension is
* uninstalled or when the collection is disposed. Defaults to false.
* Gets the extension's environment variable collection for this workspace, enabling changes
* to be applied to terminal environment variables.
*/
export function getEnvironmentVariableCollection(persistent?: boolean): EnvironmentVariableCollection;
readonly environmentVariableCollection: EnvironmentVariableCollection;
}
//#endregion
@@ -1239,22 +1251,32 @@ declare module 'vscode' {
}
/**
* Event triggered by extensions to signal to VS Code that an edit has occurred on an [`EditableCustomDocument`](#EditableCustomDocument).
* Event triggered by extensions to signal to VS Code that an edit has occurred on an [`CustomDocument`](#CustomDocument).
*
* @see [`EditableCustomDocument.onDidChange`](#EditableCustomDocument.onDidChange).
* @see [`CustomDocumentProvider.onDidChangeCustomDocument`](#CustomDocumentProvider.onDidChangeCustomDocument).
*/
interface CustomDocumentEditEvent {
interface CustomDocumentEditEvent<T extends CustomDocument = CustomDocument> {
/**
* The document that the edit is for.
*/
readonly document: T;
/**
* Undo the edit operation.
*
* This is invoked by VS Code when the user triggers an undo.
* This is invoked by VS Code when the user undoes this edit. To implement `undo`, your
* extension should restore the document and editor to the state they were in just before this
* edit was added to VS Code's internal edit stack by `onDidChangeCustomDocument`.
*/
undo(): Thenable<void> | void;
/**
* Redo the edit operation.
*
* This is invoked by VS Code when the user triggers a redo.
* This is invoked by VS Code when the user redoes this edit. To implement `redo`, your
* extension should restore the document and editor to the state they were in just after this
* edit was added to VS Code's internal edit stack by `onDidChangeCustomDocument`.
*/
redo(): Thenable<void> | void;
@@ -1267,17 +1289,20 @@ declare module 'vscode' {
}
/**
* Event triggered by extensions to signal to VS Code that the content of a [`EditableCustomDocument`](#EditableCustomDocument)
* Event triggered by extensions to signal to VS Code that the content of a [`CustomDocument`](#CustomDocument)
* has changed.
*
* @see [`EditableCustomDocument.onDidChange`](#EditableCustomDocument.onDidChange).
* @see [`CustomDocumentProvider.onDidChangeCustomDocument`](#CustomDocumentProvider.onDidChangeCustomDocument).
*/
interface CustomDocumentContentChangeEvent {
// marker interface
interface CustomDocumentContentChangeEvent<T extends CustomDocument = CustomDocument> {
/**
* The document that the change is for.
*/
readonly document: T;
}
/**
* A backup for an [`EditableCustomDocument`](#EditableCustomDocument).
* A backup for an [`CustomDocument`](#CustomDocument).
*/
interface CustomDocumentBackup {
/**
@@ -1285,55 +1310,102 @@ declare module 'vscode' {
*
* This id is passed back to your extension in `openCustomDocument` when opening a custom editor from a backup.
*/
readonly backupId: string;
readonly id: string;
/**
* Dispose of the current backup.
* Delete 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.
* This is called by VS Code when it is clear the current backup is no longer needed, such as when a new backup
* is made or when the file is saved.
*/
dispose(): void;
delete(): 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.
* Additional information used to implement [`CustomEditableDocument.backup`](#CustomEditableDocument.backup).
*/
interface EditableCustomDocument extends CustomDocument {
interface CustomDocumentBackupContext {
/**
* Save the resource for a custom editor.
* Suggested file location to write the new backup.
*
* 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.
* Note that your extension is free to ignore this and use its own strategy for backup.
*
* 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 cancellation Token that signals the save is no longer required (for example, if another save was triggered).
*
* @return Thenable signaling that saving has completed.
* For editors for workspace resource, this destination will be in the workspace storage. The path may not
*/
save(cancellation: CancellationToken): Thenable<void>;
readonly destination: Uri;
}
/**
* Additional information about the opening custom document.
*/
interface CustomDocumentOpenContext {
/**
* The id of the backup to restore the document from or `undefined` if there is no backup.
*
* If this is provided, your extension should restore the editor from the backup instead of reading the file
* the user's workspace.
*/
readonly backupId?: string;
}
/**
* Provider for readonly custom editors that use a custom document model.
*
* Custom editors use [`CustomDocument`](#CustomDocument) as their document model instead of a [`TextDocument`](#TextDocument).
*
* 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 T Type of the custom document returned by this provider.
*/
export interface CustomReadonlyEditorProvider<T extends CustomDocument = CustomDocument> {
/**
* Save the resource for a custom editor to a different location.
* Create a new document for a given resource.
*
* This method is invoked by VS Code when the user triggers `save as` on a custom editor.
* `openCustomDocument` is called when the first editor for a given resource is opened, and the resolve document
* is passed to `resolveCustomEditor`. The resolved `CustomDocument` is re-used for subsequent editor opens.
* If all editors for a given resource are closed, the `CustomDocument` is disposed of. Opening an editor at
* this point will trigger another call to `openCustomDocument`.
*
* To implement `saveAs`, the implementer must persist the custom editor to `targetResource`. The
* existing editor will remain open after `saveAs` completes.
* @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.
*
* @param targetResource Location to save to.
* @param cancellation Token that signals the save is no longer required.
*
* @return Thenable signaling that saving has completed.
* @return The custom document.
*/
saveAs(targetResource: Uri, cancellation: CancellationToken): Thenable<void>;
openCustomDocument(uri: Uri, openContext: CustomDocumentOpenContext, token: CancellationToken): Thenable<T> | T;
/**
* Resolve a custom editor for a given resource.
*
* This is called whenever the user opens a new editor for this `CustomEditorProvider`.
*
* To resolve a custom editor, the provider must fill in its initial html content and hook up all
* the event listeners it is interested it. The provider can also hold onto the `WebviewPanel` to use later,
* for example in a command. See [`WebviewPanel`](#WebviewPanel) for additional details.
*
* @param document Document for the resource being resolved.
* @param webviewPanel Webview to resolve.
* @param token A cancellation token that indicates the result is no longer needed.
*
* @return Optional thenable indicating that the custom editor has been resolved.
*/
resolveCustomEditor(document: T, webviewPanel: WebviewPanel, token: CancellationToken): Thenable<void> | void;
}
/**
* Provider for editiable custom editors that use a custom document model.
*
* Custom editors use [`CustomDocument`](#CustomDocument) as their document model instead of a [`TextDocument`](#TextDocument).
* This gives extensions full control over actions such as edit, save, and backup.
*
* 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 T Type of the custom document returned by this provider.
*/
export interface CustomEditorProvider<T extends CustomDocument = CustomDocument> extends CustomReadonlyEditorProvider<T> {
/**
* Signal that an edit has occurred inside a custom editor.
*
@@ -1354,10 +1426,43 @@ declare module 'vscode' {
*
* An editor should only ever fire `CustomDocumentEditEvent` events, or only ever fire `CustomDocumentContentChangeEvent` events.
*/
readonly onDidChange: Event<CustomDocumentEditEvent> | Event<CustomDocumentContentChangeEvent>;
readonly onDidChangeCustomDocument: Event<CustomDocumentEditEvent<T>> | Event<CustomDocumentContentChangeEvent<T>>;
/**
* Revert a custom editor to its last saved state.
* Save a custom document.
*
* 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 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.
*/
saveCustomDocument(document: T, cancellation: CancellationToken): Thenable<void>;
/**
* Save a custom document to a different location.
*
* This method is invoked by VS Code when the user triggers 'save as' on a custom editor. The implementer must
* persist the custom editor to `destination`.
*
* When the user accepts save as, the current editor is be replaced by an non-dirty editor for the newly saved file.
*
* @param document Document to save.
* @param destination Location to save to.
* @param cancellation Token that signals the save is no longer required.
*
* @return Thenable signaling that saving has completed.
*/
saveCustomDocumentAs(document: T, destination: Uri, cancellation: CancellationToken): Thenable<void>;
/**
* Revert a custom document to its last saved state.
*
* 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).
@@ -1366,17 +1471,15 @@ declare module 'vscode' {
* 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 cancellation Token that signals the revert is no longer required.
*
* @return Thenable signaling that the change has completed.
*/
revert(cancellation: CancellationToken): Thenable<void>;
revertCustomDocument(document: T, cancellation: CancellationToken): Thenable<void>;
/**
* Back up the resource in its current state.
* Back up a dirty custom document.
*
* Backups are used for hot exit and to prevent data loss. Your `backup` method should persist the resource in
* its current state, i.e. with the edits applied. Most commonly this means saving the resource to disk in
@@ -1388,72 +1491,14 @@ 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 context Information that can be used to backup the document.
* @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(cancellation: CancellationToken): Thenable<CustomDocumentBackup>;
}
/**
* Additional information about the opening custom document.
*/
interface OpenCustomDocumentContext {
/**
* The id of the backup to restore the document from or `undefined` if there is no backup.
*
* If this is provided, your extension should restore the editor from the backup instead of reading the file
* the user's workspace.
*/
readonly backupId?: string;
}
/**
* Provider for custom editors that use a custom document model.
*
* Custom editors use [`CustomDocument`](#CustomDocument) as their document model instead of a [`TextDocument`](#TextDocument).
* This gives extensions full control over actions such as edit, save, and backup.
*
* 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 DocumentType Type of the custom document returned by this provider.
*/
export interface CustomEditorProvider<DocumentType extends CustomDocument = CustomDocument> {
/**
* Create a new document for a given resource.
*
* `openCustomDocument` is called when the first editor for a given resource is opened, and the resolve document
* is passed to `resolveCustomEditor`. The resolved `CustomDocument` is re-used for subsequent editor opens.
* If all editors for a given resource are closed, the `CustomDocument` is disposed of. Opening an editor at
* 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, openContext: OpenCustomDocumentContext, token: CancellationToken): Thenable<DocumentType> | DocumentType;
/**
* Resolve a custom editor for a given resource.
*
* This is called whenever the user opens a new editor for this `CustomEditorProvider`.
*
* To resolve a custom editor, the provider must fill in its initial html content and hook up all
* the event listeners it is interested it. The provider can also hold onto the `WebviewPanel` to use later,
* for example in a command. See [`WebviewPanel`](#WebviewPanel) for additional details.
*
* @param document Document for the resource being resolved.
* @param webviewPanel Webview to resolve.
* @param token A cancellation token that indicates the result is no longer needed.
*
* @return Optional thenable indicating that the custom editor has been resolved.
*/
resolveCustomEditor(document: DocumentType, webviewPanel: WebviewPanel, token: CancellationToken): Thenable<void> | void;
backupCustomDocument(document: T, context: CustomDocumentBackupContext, cancellation: CancellationToken): Thenable<CustomDocumentBackup>;
}
namespace window {
@@ -1462,11 +1507,13 @@ declare module 'vscode' {
*/
export function registerCustomEditorProvider2(
viewType: string,
provider: CustomEditorProvider,
provider: CustomReadonlyEditorProvider | CustomEditorProvider,
options?: {
readonly webviewOptions?: WebviewPanelOptions;
/**
* Only applies to `CustomReadonlyEditorProvider | CustomEditorProvider`.
*
* Indicates that the provider allows multiple editor instances to be open at the same time for
* the same resource.
*
@@ -1477,7 +1524,7 @@ declare module 'vscode' {
* 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;
readonly supportsMultipleEditorsPerDocument?: boolean;
}
): Disposable;
}
@@ -1643,6 +1690,12 @@ declare module 'vscode' {
*/
editable?: boolean;
/**
* Controls whether the full notebook can be run at once.
* Defaults to true
*/
runnable?: boolean;
/**
* Default value for [cell editable metadata](#NotebookCellMetadata.editable).
* Defaults to true.
@@ -1759,11 +1812,12 @@ declare module 'vscode' {
export function registerNotebookOutputRenderer(type: string, outputSelector: NotebookOutputSelector, renderer: NotebookOutputRenderer): Disposable;
// remove activeNotebookDocument, now that there is activeNotebookEditor.document
export let activeNotebookDocument: NotebookDocument | undefined;
export let activeNotebookEditor: NotebookEditor | undefined;
// export const onDidChangeNotebookDocument: Event<NotebookDocumentChangeEvent>;
export const onDidChangeNotebookDocument: Event<NotebookDocumentChangeEvent>;
/**
* Create a document that is the concatenation of all notebook cells. By default all code-cells are included
@@ -2019,4 +2073,25 @@ declare module 'vscode' {
//#endregion
//#region Comment
export interface CommentOptions {
/**
* An optional string to show on the comment input box when it's collapsed.
*/
prompt?: string;
/**
* An optional string to show as placeholder in the comment input box when it's focused.
*/
placeHolder?: string;
}
export interface CommentController {
/**
* Comment controller options
*/
options?: CommentOptions;
}
//#endregion
}