From 1c7369ccabfd3b6f76e2f74344efd56eb88e766f Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Thu, 14 Mar 2019 08:41:32 -0700 Subject: [PATCH] VS Code 1.16 Extension API --- types/vscode/index.d.ts | 127 +++++++++++++++++++++++++++++++++------- 1 file changed, 107 insertions(+), 20 deletions(-) diff --git a/types/vscode/index.d.ts b/types/vscode/index.d.ts index 018ca50471..4f81092898 100644 --- a/types/vscode/index.d.ts +++ b/types/vscode/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Visual Studio Code 1.15 +// Type definitions for Visual Studio Code 1.16 // Project: https://github.com/microsoft/vscode-extension-vscode // Definitions by: Visual Studio Code Team, Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -10,7 +10,7 @@ *--------------------------------------------------------------------------------------------*/ /** - * Type Definition for Visual Studio Code 1.15 Extension API + * Type Definition for Visual Studio Code 1.16 Extension API */ declare module 'vscode' { @@ -1828,11 +1828,50 @@ declare module 'vscode' { } /** - * MarkedString can be used to render human readable text. It is either a markdown string - * or a code-block that provides a language and a code snippet. Note that - * markdown strings will be sanitized - that means html will be escaped. + * The MarkdownString represents human readable text that supports formatting via the + * markdown syntax. Standard markdown is supported, also tables, but no embedded html. */ - export type MarkedString = string | { language: string; value: string }; + export class MarkdownString { + + /** + * The markdown string. + */ + value: string; + + /** + * Indicates that this markdown string is from a trusted source. Only *trusted* + * markdown supports links that execute commands, e.g. `[Run it](command:myCommandId)`. + */ + isTrusted?: boolean; + + /** + * Creates a new markdown string with the given value. + * + * @param value Optional, initial value. + */ + constructor(value?: string); + + /** + * Appends and escapes the given string to this markdown string. + * @param value Plain text. + */ + appendText(value: string): MarkdownString; + + /** + * Appends the given string 'as is' to this markdown string. + * @param value Markdown string. + */ + appendMarkdown(value: string): MarkdownString; + } + + /** + * ~~MarkedString can be used to render human readable text. It is either a markdown string + * or a code-block that provides a language and a code snippet. Note that + * markdown strings will be sanitized - that means html will be escaped.~~ + * + * @deprecated This type is deprecated, please use [`MarkdownString`](#MarkdownString) instead. + */ + export type MarkedString = MarkdownString | string | { language: string; value: string }; /** * A hover represents additional information for a symbol or word. Hovers are @@ -3082,8 +3121,11 @@ declare module 'vscode' { * @param section Configuration name, supports _dotted_ names. * @param value The new value. * @param configurationTarget The [configuration target](#ConfigurationTarget) or a boolean value. - * If `undefined` or `null` or `false` configuration target is `ConfigurationTarget.Workspace`. - * If `true` configuration target is `ConfigurationTarget.Global`. + * - If `true` configuration target is `ConfigurationTarget.Global`. + * - If `false` configuration target is `ConfigurationTarget.Workspace`. + * - If `undefined` or `null` configuration target is + * `ConfigurationTarget.WorkspaceFolder` when configuration is resource specific + * `ConfigurationTarget.Workspace` otherwise. */ update(section: string, value: any, configurationTarget?: ConfigurationTarget | boolean): Thenable; @@ -3710,7 +3752,7 @@ declare module 'vscode' { */ export interface TaskDefinition { /** - * The task definition descibing the task provided by an extension. + * The task definition describing the task provided by an extension. * Usually a task provider defines more properties to identify * a task. They need to be defined in the package.json of the * extension under the 'taskDefinitions' extension point. The npm @@ -3845,7 +3887,7 @@ declare module 'vscode' { /** * Creates a new task. * - * @param definition The task definition as defined in the taskDefintions extension point. + * @param definition The task definition as defined in the taskDefinitions extension point. * @param name The task's name. Is presented in the user interface. * @param source The task's source (e.g. 'gulp', 'npm', ...). Is presented in the user interface. * @param execution The process or shell execution. @@ -3903,7 +3945,7 @@ declare module 'vscode' { /** * A task provider allows to add tasks to the task service. - * A task provider is registerd via #workspace.registerTaskProvider. + * A task provider is registered via #workspace.registerTaskProvider. */ export interface TaskProvider { /** @@ -3938,6 +3980,13 @@ declare module 'vscode' { */ export let appName: string; + /** + * The application root folder from which the editor is running. + * + * @readonly + */ + export let appRoot: string; + /** * Represents the preferred user-language, like `de-CH`, `fr`, or `en-US`. * @@ -4032,10 +4081,10 @@ declare module 'vscode' { /** * Executes the command denoted by the given command identifier. * - * When executing an editor command not all types are allowed to + * * *Note 1:* When executing an editor command not all types are allowed to * be passed as arguments. Allowed are the primitive types `string`, `boolean`, - * `number`, `undefined`, and `null`, as well as classes defined in this API. - * There are no restrictions when executing commands that have been contributed + * `number`, `undefined`, and `null`, as well as [`Position`](#Position), [`Range`](#Range), [`Uri`](#Uri) and [`Location`](#Location). + * * *Note 2:* There are no restrictions when executing commands that have been contributed * by extensions. * * @param command Identifier of the command to execute. @@ -4055,6 +4104,17 @@ declare module 'vscode' { export function getCommands(filterInternal?: boolean): Thenable; } + /** + * Represents the state of a window. + */ + export interface WindowState { + + /** + * Whether the current window is focused. + */ + readonly focused: boolean; + } + /** * Namespace for dealing with the current window of the editor. That is visible * and active editors, as well as, UI elements to show messages, selections, and @@ -4107,6 +4167,19 @@ declare module 'vscode' { */ export const onDidCloseTerminal: Event; + /** + * Represents the current window's state. + * + * @readonly + */ + export let state: WindowState; + + /** + * An [event](#Event) which fires when the focus state of the current window + * changes. The value of the event represents whether the window is focused. + */ + export const onDidChangeWindowState: Event; + /** * Show the given document in a text editor. A [column](#ViewColumn) can be provided * to control where the editor is being shown. Might change the [active editor](#window.activeTextEditor). @@ -4688,7 +4761,7 @@ declare module 'vscode' { /** * A workspace folder is one of potentially many roots opened by the editor. All workspace folders - * are equal which means there is notion of an active or master workspace folder. + * are equal which means there is no notion of an active or master workspace folder. */ export interface WorkspaceFolder { @@ -5315,6 +5388,12 @@ declare module 'vscode' { */ readonly faded?: boolean; + /** + * The title for a specific + * [source control resource state](#SourceControlResourceState). + */ + readonly tooltip?: string; + /** * The light theme decorations. */ @@ -5400,6 +5479,11 @@ declare module 'vscode' { */ readonly label: string; + /** + * The [input box](#SourceControlInputBox) for this source control. + */ + readonly inputBox: SourceControlInputBox; + /** * The UI-visible count of [resource states](#SourceControlResourceState) of * this source control. @@ -5451,14 +5535,17 @@ declare module 'vscode' { export namespace scm { /** - * The [input box](#SourceControlInputBox) in the Source Control viewlet. + * ~~The [input box](#SourceControlInputBox) for the last source control + * created by the extension.~~ + * + * @deprecated Use [SourceControl.inputBox](#SourceControl.inputBox) instead */ export const inputBox: SourceControlInputBox; /** * Creates a new [source control](#SourceControl) instance. * - * @param id A unique `id` for the source control. Something short, eg: `git`. + * @param id An `id` for the source control. Something short, eg: `git`. * @param label A human-readable string for the source control. Eg: `Git`. * @return An instance of [source control](#SourceControl). */ @@ -5470,14 +5557,14 @@ declare module 'vscode' { */ export interface DebugConfiguration { /** - * The type for the debug session. + * The type of the debug session. */ type: string; /** - * An optional name for the debug session. + * The name of the debug session. */ - name?: string; + name: string; /** * The request type of the debug session.