Merge VS Code 1.23.1 (#1520)

This commit is contained in:
Matt Irvine
2018-06-05 11:24:51 -07:00
committed by GitHub
parent e3baf5c443
commit 0c58f09e59
3651 changed files with 74249 additions and 48599 deletions

View File

@@ -7,142 +7,55 @@
declare module 'vscode' {
export class FoldingRangeList {
/**
* The folding ranges.
*/
ranges: FoldingRange[];
/**
* Creates mew folding range list.
*
* @param ranges The folding ranges
*/
constructor(ranges: FoldingRange[]);
export namespace window {
export function sampleFunction(): Thenable<any>;
}
//#region Joh: file system provider (OLD)
export class FoldingRange {
/**
* The start line number (0-based)
*/
startLine: number;
/**
* The end line number (0-based)
*/
endLine: number;
/**
* The actual color value for this color range.
*/
type?: FoldingRangeType | string;
/**
* Creates a new folding range.
*
* @param startLineNumber The first line of the fold
* @param type The last line of the fold
*/
constructor(startLineNumber: number, endLineNumber: number, type?: FoldingRangeType | string);
}
export enum FoldingRangeType {
/**
* Folding range for a comment
*/
Comment = 'comment',
/**
* Folding range for a imports or includes
*/
Imports = 'imports',
/**
* Folding range for a region (e.g. `#region`)
*/
Region = 'region'
}
// export enum FileErrorCodes {
// /**
// * Not owner.
// */
// EPERM = 1,
// /**
// * No such file or directory.
// */
// ENOENT = 2,
// /**
// * I/O error.
// */
// EIO = 5,
// /**
// * Permission denied.
// */
// EACCES = 13,
// /**
// * File exists.
// */
// EEXIST = 17,
// /**
// * Not a directory.
// */
// ENOTDIR = 20,
// /**
// * Is a directory.
// */
// EISDIR = 21,
// /**
// * File too large.
// */
// EFBIG = 27,
// /**
// * No space left on device.
// */
// ENOSPC = 28,
// /**
// * Directory is not empty.
// */
// ENOTEMPTY = 66,
// /**
// * Invalid file handle.
// */
// ESTALE = 70,
// /**
// * Illegal NFS file handle.
// */
// EBADHANDLE = 10001,
// }
export enum FileChangeType {
export enum DeprecatedFileChangeType {
Updated = 0,
Added = 1,
Deleted = 2
}
export interface FileChange {
type: FileChangeType;
export interface DeprecatedFileChange {
type: DeprecatedFileChangeType;
resource: Uri;
}
export enum FileType {
export enum DeprecatedFileType {
File = 0,
Dir = 1,
Symlink = 2
}
export interface FileStat {
export interface DeprecatedFileStat {
id: number | string;
mtime: number;
// atime: number;
size: number;
type: FileType;
type: DeprecatedFileType;
}
export interface DeprecatedFileSystemProvider {
readonly onDidChange?: Event<DeprecatedFileChange[]>;
utimes(resource: Uri, mtime: number, atime: number): Thenable<DeprecatedFileStat>;
stat(resource: Uri): Thenable<DeprecatedFileStat>;
read(resource: Uri, offset: number, length: number, progress: Progress<Uint8Array>): Thenable<number>;
write(resource: Uri, content: Uint8Array): Thenable<void>;
move(resource: Uri, target: Uri): Thenable<DeprecatedFileStat>;
mkdir(resource: Uri): Thenable<DeprecatedFileStat>;
readdir(resource: Uri): Thenable<[Uri, DeprecatedFileStat][]>;
rmdir(resource: Uri): Thenable<void>;
unlink(resource: Uri): Thenable<void>;
}
export namespace workspace {
export function registerDeprecatedFileSystemProvider(scheme: string, provider: DeprecatedFileSystemProvider): Disposable;
}
//#endregion
//#region Joh: remote, search provider
export interface TextSearchQuery {
pattern: string;
isRegex?: boolean;
isRegExp?: boolean;
isCaseSensitive?: boolean;
isWordMatch?: boolean;
}
@@ -158,68 +71,18 @@ declare module 'vscode' {
preview: { leading: string, matching: string, trailing: string };
}
// todo@joh discover files etc
// todo@joh CancellationToken everywhere
// todo@joh add open/close calls?
export interface FileSystemProvider {
readonly onDidChange?: Event<FileChange[]>;
// todo@joh - remove this
readonly root?: Uri;
// more...
//
utimes(resource: Uri, mtime: number, atime: number): Thenable<FileStat>;
stat(resource: Uri): Thenable<FileStat>;
read(resource: Uri, offset: number, length: number, progress: Progress<Uint8Array>): Thenable<number>;
// todo@joh - have an option to create iff not exist
// todo@remote
// offset - byte offset to start
// count - number of bytes to write
// Thenable<number> - number of bytes actually written
write(resource: Uri, content: Uint8Array): Thenable<void>;
// todo@remote
// Thenable<FileStat>
move(resource: Uri, target: Uri): Thenable<FileStat>;
// todo@remote
// helps with performance bigly
// copy?(from: Uri, to: Uri): Thenable<void>;
// todo@remote
// Thenable<FileStat>
mkdir(resource: Uri): Thenable<FileStat>;
readdir(resource: Uri): Thenable<[Uri, FileStat][]>;
// todo@remote
// ? merge both
// ? recursive del
rmdir(resource: Uri): Thenable<void>;
unlink(resource: Uri): Thenable<void>;
// todo@remote
// create(resource: Uri): Thenable<FileStat>;
// find files by names
// todo@joh, move into its own provider
findFiles?(query: string, progress: Progress<Uri>, token: CancellationToken): Thenable<void>;
export interface SearchProvider {
provideFileSearchResults?(query: string, progress: Progress<Uri>, token: CancellationToken): Thenable<void>;
provideTextSearchResults?(query: TextSearchQuery, options: TextSearchOptions, progress: Progress<TextSearchResult>, token: CancellationToken): Thenable<void>;
}
export namespace workspace {
export function registerFileSystemProvider(scheme: string, provider: FileSystemProvider): Disposable;
export function registerSearchProvider(scheme: string, provider: SearchProvider): Disposable;
}
export namespace window {
//#endregion
export function sampleFunction(): Thenable<any>;
}
//#region Joao: diff command
/**
* The contiguous set of modified lines in a diff.
@@ -250,7 +113,9 @@ declare module 'vscode' {
export function registerDiffInformationCommand(command: string, callback: (diff: LineChange[], ...args: any[]) => any, thisArg?: any): Disposable;
}
//#region decorations
//#endregion
//#region Joh: decorations
//todo@joh -> make class
export interface DecorationData {
@@ -283,6 +148,10 @@ declare module 'vscode' {
// remove debug namespace
//#endregion
//#region Rob, Matt: logging
/**
* The severity level of a log message
*/
@@ -300,10 +169,6 @@ declare module 'vscode' {
* A logger for writing to an extension's log file, and accessing its dedicated log directory.
*/
export interface Logger {
readonly onDidChangeLogLevel: Event<LogLevel>;
readonly currentLevel: LogLevel;
readonly logDirectory: Thenable<string>;
trace(message: string, ...args: any[]): void;
debug(message: string, ...args: any[]): void;
info(message: string, ...args: any[]): void;
@@ -317,36 +182,28 @@ declare module 'vscode' {
* This extension's logger
*/
logger: Logger;
}
export interface RenameInitialValue {
range: Range;
text?: string;
}
export namespace languages {
/**
* Register a folding provider.
* Path where an extension can write log files.
*
* Multiple folding can be registered for a language. In that case providers are sorted
* by their [score](#languages.match) and the best-matching provider is used. Failure
* of the selected provider will cause a failure of the whole operation.
*
* @param selector A selector that defines the documents this provider is applicable to.
* @param provider A folding provider.
* @return A [disposable](#Disposable) that unregisters this provider when being disposed.
* Extensions must create this directory before writing to it. The parent directory will always exist.
*/
export function registerFoldingProvider(selector: DocumentSelector, provider: FoldingProvider): Disposable;
readonly logDirectory: string;
}
export interface RenameProvider2 extends RenameProvider {
resolveInitialRenameValue?(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<RenameInitialValue>;
}
}
export interface FoldingProvider {
provideFoldingRanges(document: TextDocument, token: CancellationToken): ProviderResult<FoldingRangeList>;
export namespace env {
/**
* Current logging level.
*
* @readonly
*/
export const logLevel: LogLevel;
}
//#endregion
//#region Joao: SCM validation
/**
* Represents the validation type of the Source Control input.
*/
@@ -393,246 +250,218 @@ declare module 'vscode' {
validateInput?(value: string, cursorPosition: number): ProviderResult<SourceControlInputBoxValidation | undefined | null>;
}
/**
* Content settings for a webview.
*/
export interface WebviewOptions {
/**
* Should scripts be enabled in the webview content?
*
* Defaults to false (scripts-disabled).
*/
readonly enableScripts?: boolean;
//#endregion
/**
* Should command uris be enabled in webview content?
*
* Defaults to false.
*/
readonly enableCommandUris?: boolean;
/**
* Should the webview's context be kept around even when the webview is no longer visible?
*
* Normally a webview's context is created when the webview becomes visible
* and destroyed when the webview is hidden. Apps that have complex state
* or UI can set the `retainContextWhenHidden` to make VS Code keep the webview
* context around, even when the webview moves to a background tab. When
* the webview becomes visible again, the context is automatically restored
* in the exact same state it was in originally.
*
* `retainContextWhenHidden` has a high memory overhead and should only be used if
* your webview's context cannot be quickly saved and restored.
*/
readonly retainContextWhenHidden?: boolean;
/**
* Root paths from which the webview can load local (filesystem) resources using the `vscode-workspace-resource:` scheme.
*
* Default to the root folders of the current workspace.
*
* Pass in an empty array to disallow access to any local resources.
*/
readonly localResourceRoots?: Uri[];
}
//#region Matt: WebView Serializer
/**
* A webview is an editor with html content, like an iframe.
* Save and restore webview panels that have been persisted when vscode shuts down.
*/
export interface Webview {
interface WebviewPanelSerializer {
/**
* Type identifying the editor as a webview editor.
*/
readonly editorType: 'webview';
/**
* Unique identifer of the webview.
*/
readonly uri: Uri;
/**
* Content settings for the webview.
*/
readonly options: WebviewOptions;
/**
* Title of the webview shown in UI.
*/
title: string;
/**
* Contents of the webview.
* Save a webview panel's `state`.
*
* Should be a complete html document.
*/
html: string;
/**
* The column in which the webview is showing.
*/
readonly viewColumn?: ViewColumn;
/**
* Fired when the webview content posts a message.
*/
readonly onDidReceiveMessage: Event<any>;
/**
* Fired when the webview is disposed.
*/
readonly onDidDispose: Event<void>;
/**
* Fired when the webview's view column changes.
*/
readonly onDidChangeViewColumn: Event<ViewColumn>;
/**
* Post a message to the webview content.
* Called before shutdown. Extensions have a 250ms timeframe to return a state. If serialization
* takes longer than 250ms, the panel will not be serialized.
*
* Messages are only develivered if the webview is visible.
* @param webviewPanel webview Panel to serialize. May or may not be visible.
*
* @param message Body of the message.
* @returns JSON serializable state blob.
*/
postMessage(message: any): Thenable<boolean>;
serializeWebviewPanel(webviewPanel: WebviewPanel): Thenable<any>;
/**
* Shows the webview in a given column.
* Restore a webview panel from its seriailzed `state`.
*
* A webview may only show in a single column at a time. If it is already showing, this
* command moves it to a new column.
*/
show(viewColumn: ViewColumn): void;
/**
* Dispose of the the webview.
* Called when a serialized webview first becomes visible.
*
* This closes the webview if it showing and disposes of the resources owned by the webview.
* Webview are also disposed when the user closes the webview editor. Both cases fire `onDispose`
* event. Trying to use the webview after it has been disposed throws an exception.
* @param webviewPanel Webview panel to restore. The serializer should take ownership of this panel.
* @param state Persisted state.
*
* @return Thanble indicating that the webview has been fully restored.
*/
dispose(): any;
}
export interface TextEditor {
/**
* Type identifying the editor as a text editor.
*/
readonly editorType: 'texteditor';
deserializeWebviewPanel(webviewPanel: WebviewPanel, state: any): Thenable<void>;
}
namespace window {
/**
* Create and show a new webview.
* Registers a webview panel serializer.
*
* @param uri Unique identifier for the webview.
* @param title Title of the webview.
* @param column Editor column to show the new webview in.
* @param options Content settings for the webview.
* Extensions that support reviving should have an `"onView:viewType"` activation method and
* make sure that [registerWebviewPanelSerializer](#registerWebviewPanelSerializer) is called during activation.
*
* Only a single serializer may be registered at a time for a given `viewType`.
*
* @param viewType Type of the webview panel that can be serialized.
* @param reviver Webview serializer.
*/
export function createWebview(uri: Uri, title: string, column: ViewColumn, options: WebviewOptions): Webview;
export function registerWebviewPanelSerializer(viewType: string, reviver: WebviewPanelSerializer): Disposable;
}
//#endregion
//#region Tasks
/**
* An object representing an executed Task. It can be used
* to terminate a task.
*
* This interface is not intended to be implemented.
*/
export interface TaskExecution {
/**
* The task that got started.
*/
task: Task;
/**
* Event fired when the active editor changes.
* Terminates the task execution.
*/
export const onDidChangeActiveEditor: Event<TextEditor | Webview | undefined>;
terminate(): void;
}
/**
* An event signaling the start of a task execution.
*
* This interface is not intended to be implemented.
*/
interface TaskStartEvent {
/**
* The task item representing the task that got started.
*/
execution: TaskExecution;
}
/**
* An event signaling the end of an executed task.
*
* This interface is not intended to be implemented.
*/
interface TaskEndEvent {
/**
* The task item representing the task that finished.
*/
execution: TaskExecution;
}
export interface TaskFilter {
/**
* The task version as used in the tasks.json file.
* The string support the package.json semver notation.
*/
version?: string;
/**
* The task type to return;
*/
type?: string;
}
export namespace workspace {
/**
* Fetches all task available in the systems. Thisweweb includes tasks
* from `tasks.json` files as well as tasks from task providers
* contributed through extensions.
*
* @param filter a filter to filter the return tasks.
*/
export function fetchTasks(filter?: TaskFilter): Thenable<Task[]>;
/**
* Executes a task that is managed by VS Code. The returned
* task execution can be used to terminate the task.
*
* @param task the task to execute
*/
export function executeTask(task: Task): Thenable<TaskExecution>;
/**
* The currently active task executions or an empty array.
*
* @readonly
*/
export let taskExecutions: ReadonlyArray<TaskExecution>;
/**
* Fires when a task starts.
*/
export const onDidStartTask: Event<TaskStartEvent>;
/**
* Fires when a task ends.
*/
export const onDidEndTask: Event<TaskEndEvent>;
}
//#endregion
//#region Terminal
export interface Terminal {
/**
* Fires when the terminal's pty slave pseudo-device is written to. In other words, this
* provides access to the raw data stream from the process running within the terminal,
* including ANSI sequences.
*/
onData: Event<string>;
}
export namespace window {
/**
* The currently active terminals or an empty array.
*
* @readonly
*/
export let terminals: Terminal[];
/**
* An [event](#Event) which fires when a terminal has been created, either through the
* [createTerminal](#window.createTerminal) API or commands.
*/
export const onDidOpenTerminal: Event<Terminal>;
}
//#endregion
//#region URLs
export interface ProtocolHandler {
handleUri(uri: Uri): void;
}
export namespace window {
/**
* Register a [TreeDataProvider](#TreeDataProvider) for the view contributed using the extension point `views`.
* @param viewId Id of the view contributed using the extension point `views`.
* @param treeDataProvider A [TreeDataProvider](#TreeDataProvider) that provides tree data for the view
* @return handle to the [treeview](#TreeView) that can be disposable.
* Registers a protocol handler capable of handling system-wide URIs.
*/
export function registerTreeDataProvider<T>(viewId: string, treeDataProvider: TreeDataProvider<T>): TreeView<T>;
export function registerProtocolHandler(handler: ProtocolHandler): Disposable;
}
/**
* Represents a Tree view
*/
export interface TreeView<T> extends Disposable {
//#endregion
/**
* Reveal an element. By default revealed element is selected.
*
* In order to not to select, set the option `select` to `false`.
*
* **NOTE:** [TreeDataProvider](#TreeDataProvider) is required to implement [getParent](#TreeDataProvider.getParent) method to access this API.
*/
reveal(element: T, options?: { select?: boolean }): Thenable<void>;
//#region Joh: hierarchical document symbols, https://github.com/Microsoft/vscode/issues/34968
export class HierarchicalSymbolInformation {
name: string;
kind: SymbolKind;
location: Location;
range: Range;
children: HierarchicalSymbolInformation[];
constructor(name: string, kind: SymbolKind, location: Location, range: Range);
}
/**
* A data provider that provides tree data
*/
export interface TreeDataProvider<T> {
/**
* An optional event to signal that an element or root has changed.
* This will trigger the view to update the changed element/root and its children recursively (if shown).
* To signal that root has changed, do not pass any argument or pass `undefined` or `null`.
*/
onDidChangeTreeData?: Event<T | undefined | null>;
/**
* Get [TreeItem](#TreeItem) representation of the `element`
*
* @param element The element for which [TreeItem](#TreeItem) representation is asked for.
* @return [TreeItem](#TreeItem) representation of the element
*/
getTreeItem(element: T): TreeItem | Thenable<TreeItem>;
/**
* Get the children of `element` or root if no element is passed.
*
* @param element The element from which the provider gets children. Can be `undefined`.
* @return Children of `element` or root if no element is passed.
*/
getChildren(element?: T): ProviderResult<T[]>;
/**
* Optional method to return the parent of `element`.
* Return `null` or `undefined` if `element` is a child of root.
*
* **NOTE:** This method should be implemented in order to access [reveal](#TreeView.reveal) API.
*
* @param element The element for which the parent has to be returned.
* @return Parent of `element`.
*/
getParent?(element: T): ProviderResult<T>;
export interface DocumentSymbolProvider {
provideDocumentSymbols(document: TextDocument, token: CancellationToken): ProviderResult<HierarchicalSymbolInformation | SymbolInformation[]>;
}
//#region TextEditor.visibleRange and related event
//#endregion
export interface TextEditor {
/**
* The current visible ranges in the editor (vertically).
* This accounts only for vertical scrolling, and not for horizontal scrolling.
*/
readonly visibleRanges: Range[];
}
//#region Joh -> exclusive document filters
/**
* Represents an event describing the change in a [text editor's visible ranges](#TextEditor.visibleRanges).
*/
export interface TextEditorVisibleRangesChangeEvent {
/**
* The [text editor](#TextEditor) for which the visible ranges have changed.
*/
textEditor: TextEditor;
/**
* The new value for the [text editor's visible ranges](#TextEditor.visibleRanges).
*/
visibleRanges: Range[];
}
export namespace window {
/**
* An [event](#Event) which fires when the selection in an editor has changed.
*/
export const onDidChangeTextEditorVisibleRanges: Event<TextEditorVisibleRangesChangeEvent>;
export interface DocumentFilter {
exclusive?: boolean;
}
//#endregion