Merge from master

This commit is contained in:
Raj Musuku
2019-02-21 17:56:04 -08:00
parent 5a146e34fa
commit 666ae11639
11482 changed files with 119352 additions and 255574 deletions

View File

@@ -3,16 +3,49 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// This is the place for API experiments and proposal.
import { QuickPickItem } from 'vscode';
/**
* This is the place for API experiments and proposals.
* These API are NOT stable and subject to change. They are only available in the Insiders
* distribution and CANNOT be used in published extensions.
*
* To test these API in local environment:
* - Use Insiders release of VS Code.
* - Add `"enableProposedApi": true` to your package.json.
* - Copy this file to your project.
*/
declare module 'vscode' {
export namespace window {
export function sampleFunction(): Thenable<any>;
//#region Joh - selection range provider
export interface SelectionRangeProvider {
/**
* Provide selection ranges starting at a given position. The first range must [contain](#Range.contains)
* position and subsequent ranges must contain the previous range.
* @param document
* @param position
* @param token
*/
provideSelectionRanges(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Range[]>;
}
export namespace languages {
export function registerSelectionRangeProvider(selector: DocumentSelector, provider: SelectionRangeProvider): Disposable;
}
//#endregion
//#region Joh - read/write in chunks
export interface FileSystemProvider {
open?(resource: Uri): number | Thenable<number>;
close?(fd: number): void | Thenable<void>;
read?(fd: number, pos: number, data: Uint8Array, offset: number, length: number): number | Thenable<number>;
write?(fd: number, pos: number, data: Uint8Array, offset: number, length: number): number | Thenable<number>;
}
//#endregion
//#region Rob: search provider
/**
@@ -24,6 +57,11 @@ declare module 'vscode' {
*/
pattern: string;
/**
* Whether or not `pattern` should match multiple lines of text.
*/
isMultiline?: boolean;
/**
* Whether or not `pattern` should be interpreted as a regular expression.
*/
@@ -77,6 +115,30 @@ declare module 'vscode' {
* See the vscode setting `"search.followSymlinks"`.
*/
followSymlinks: boolean;
/**
* Whether global files that exclude files, like .gitignore, should be respected.
* See the vscode setting `"search.useGlobalIgnoreFiles"`.
*/
useGlobalIgnoreFiles: boolean;
}
/**
* Options to specify the size of the result text preview.
* These options don't affect the size of the match itself, just the amount of preview text.
*/
export interface TextSearchPreviewOptions {
/**
* The maximum number of lines in the preview.
* Only search providers that support multiline search will ever return more than one line in the match.
*/
matchLines: number;
/**
* The maximum number of characters included per line.
*/
charsPerLine: number;
}
/**
@@ -89,9 +151,9 @@ declare module 'vscode' {
maxResults: number;
/**
* TODO@roblou - total length? # of context lines? leading and trailing # of chars?
* Options to specify the size of the result text preview.
*/
previewOptions?: any;
previewOptions?: TextSearchPreviewOptions;
/**
* Exclude files larger than `maxFileSize` in bytes.
@@ -103,6 +165,30 @@ declare module 'vscode' {
* See the vscode setting `"files.encoding"`
*/
encoding?: string;
/**
* Number of lines of context to include before each match.
*/
beforeContext?: number;
/**
* Number of lines of context to include after each match.
*/
afterContext?: number;
}
/**
* Information collected when text search is complete.
*/
export interface TextSearchComplete {
/**
* Whether the search hit the limit on the maximum number of search results.
* `maxResults` on [`TextSearchOptions`](#TextSearchOptions) specifies the max number of results.
* - If exactly that number of matches exist, this should be false.
* - If `maxResults` matches are returned and more exist, this should be true.
* - If search hits an internal limit which is less than `maxResults`, this should be true.
*/
limitHit?: boolean;
}
/**
@@ -122,7 +208,13 @@ declare module 'vscode' {
/**
* The maximum number of results to be returned.
*/
maxResults: number;
maxResults?: number;
/**
* A CancellationToken that represents the session for this search query. If the provider chooses to, this object can be used as the key for a cache,
* and searches with the same session object can search the same cache. When the token is cancelled, the session is complete and the cache can be cleared.
*/
session?: CancellationToken;
}
/**
@@ -130,39 +222,65 @@ declare module 'vscode' {
*/
export interface FileIndexOptions extends SearchOptions { }
export interface TextSearchResultPreview {
/**
* A preview of the text result.
*/
export interface TextSearchMatchPreview {
/**
* The matching line of text, or a portion of the matching line that contains the match.
* For now, this can only be a single line.
* The matching lines of text, or a portion of the matching line that contains the match.
*/
text: string;
/**
* The Range within `text` corresponding to the text of the match.
* The number of matches must match the TextSearchMatch's range property.
*/
match: Range;
matches: Range | Range[];
}
/**
* A match from a text search
*/
export interface TextSearchResult {
export interface TextSearchMatch {
/**
* The uri for the matching document.
*/
uri: Uri;
/**
* The range of the match within the document.
* The range of the match within the document, or multiple ranges for multiple matches.
*/
range: Range;
ranges: Range | Range[];
/**
* A preview of the matching line
* A preview of the text match.
*/
preview: TextSearchResultPreview;
preview: TextSearchMatchPreview;
}
/**
* A line of context surrounding a TextSearchMatch.
*/
export interface TextSearchContext {
/**
* The uri for the matching document.
*/
uri: Uri;
/**
* One line of text.
* previewOptions.charsPerLine applies to this
*/
text: string;
/**
* The line number of this line of context.
*/
lineNumber: number;
}
export type TextSearchResult = TextSearchMatch | TextSearchContext;
/**
* A FileIndexProvider provides a list of files in the given folder. VS Code will filter that list for searching with quickopen or from other extensions.
*
@@ -180,7 +298,7 @@ declare module 'vscode' {
* @param options A set of options to consider while searching.
* @param token A cancellation token.
*/
provideFileIndex(options: FileIndexOptions, token: CancellationToken): Thenable<Uri[]>;
provideFileIndex(options: FileIndexOptions, token: CancellationToken): ProviderResult<Uri[]>;
}
/**
@@ -202,7 +320,7 @@ declare module 'vscode' {
* @param progress A progress callback that must be invoked for all results.
* @param token A cancellation token.
*/
provideFileSearchResults(query: FileSearchQuery, options: FileSearchOptions, token: CancellationToken): Thenable<Uri[]>;
provideFileSearchResults(query: FileSearchQuery, options: FileSearchOptions, token: CancellationToken): ProviderResult<Uri[]>;
}
/**
@@ -216,7 +334,7 @@ declare module 'vscode' {
* @param progress A progress callback that must be invoked for all results.
* @param token A cancellation token.
*/
provideTextSearchResults(query: TextSearchQuery, options: TextSearchOptions, progress: Progress<TextSearchResult>, token: CancellationToken): Thenable<void>;
provideTextSearchResults(query: TextSearchQuery, options: TextSearchOptions, progress: Progress<TextSearchResult>, token: CancellationToken): ProviderResult<TextSearchComplete>;
}
/**
@@ -248,6 +366,12 @@ declare module 'vscode' {
*/
useIgnoreFiles?: boolean;
/**
* Whether global files that exclude files, like .gitignore, should be respected.
* See the vscode setting `"search.useGlobalIgnoreFiles"`.
*/
useGlobalIgnoreFiles?: boolean;
/**
* Whether symlinks should be followed while searching.
* See the vscode setting `"search.followSymlinks"`.
@@ -259,6 +383,21 @@ declare module 'vscode' {
* See the vscode setting `"files.encoding"`
*/
encoding?: string;
/**
* Options to specify the size of the result text preview.
*/
previewOptions?: TextSearchPreviewOptions;
/**
* Number of lines of context to include before each match.
*/
beforeContext?: number;
/**
* Number of lines of context to include after each match.
*/
afterContext?: number;
}
export namespace workspace {
@@ -307,7 +446,7 @@ declare module 'vscode' {
* @param token A token that can be used to signal cancellation to the underlying search engine.
* @return A thenable that resolves when the search is complete.
*/
export function findTextInFiles(query: TextSearchQuery, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<void>;
export function findTextInFiles(query: TextSearchQuery, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<TextSearchComplete>;
/**
* Search text in files across all [workspace folders](#workspace.workspaceFolders) in the workspace.
@@ -317,7 +456,7 @@ declare module 'vscode' {
* @param token A token that can be used to signal cancellation to the underlying search engine.
* @return A thenable that resolves when the search is complete.
*/
export function findTextInFiles(query: TextSearchQuery, options: FindTextInFilesOptions, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<void>;
export function findTextInFiles(query: TextSearchQuery, options: FindTextInFilesOptions, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<TextSearchComplete>;
}
//#endregion
@@ -359,12 +498,12 @@ declare module 'vscode' {
//todo@joh -> make class
export interface DecorationData {
priority?: number;
letter?: string;
title?: string;
bubble?: boolean;
abbreviation?: string;
color?: ThemeColor;
source?: string;
priority?: number;
bubble?: boolean;
source?: string; // hacky... we should remove it and use equality under the hood
}
export interface SourceControlResourceDecorations {
@@ -406,39 +545,16 @@ declare module 'vscode' {
Off = 7
}
/**
* A logger for writing to an extension's log file, and accessing its dedicated log directory.
*/
export interface Logger {
trace(message: string, ...args: any[]): void;
debug(message: string, ...args: any[]): void;
info(message: string, ...args: any[]): void;
warn(message: string, ...args: any[]): void;
error(message: string | Error, ...args: any[]): void;
critical(message: string | Error, ...args: any[]): void;
}
export interface ExtensionContext {
/**
* This extension's logger
*/
logger: Logger;
/**
* Path where an extension can write log files.
*
* Extensions must create this directory before writing to it. The parent directory will always exist.
*/
readonly logDirectory: string;
}
export namespace env {
/**
* Current logging level.
*
* @readonly
*/
export const logLevel: LogLevel;
/**
* An [event](#Event) that fires when the log level has changed.
*/
export const onDidChangeLogLevel: Event<LogLevel>;
}
//#endregion
@@ -493,14 +609,58 @@ declare module 'vscode' {
//#endregion
//#region Joao: SCM selected provider
export interface SourceControl {
/**
* Whether the source control is selected.
*/
readonly selected: boolean;
/**
* An event signaling when the selection state changes.
*/
readonly onDidChangeSelection: Event<boolean>;
}
//#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 Comments
/**
* Comments provider related APIs are still in early stages, they may be changed significantly during our API experiments.
*/
interface CommentInfo {
/**
* All of the comment threads associated with the document.
*/
threads: CommentThread[];
/**
* The ranges of the document which support commenting.
*/
commentingRanges?: Range[];
/**
* If it's in draft mode or not
*/
inDraftMode?: boolean;
}
export enum CommentThreadCollapsibleState {
@@ -514,20 +674,89 @@ declare module 'vscode' {
Expanded = 1
}
/**
* A collection of comments representing a conversation at a particular range in a document.
*/
interface CommentThread {
/**
* A unique identifier of the comment thread.
*/
threadId: string;
/**
* The uri of the document the thread has been created on.
*/
resource: Uri;
/**
* The range the comment thread is located within the document. The thread icon will be shown
* at the first line of the range.
*/
range: Range;
/**
* The ordered comments of the thread.
*/
comments: Comment[];
/**
* Whether the thread should be collapsed or expanded when opening the document. Defaults to Collapsed.
*/
collapsibleState?: CommentThreadCollapsibleState;
}
/**
* A comment is displayed within the editor or the Comments Panel, depending on how it is provided.
*/
interface Comment {
/**
* The id of the comment
*/
commentId: string;
/**
* The text of the comment
*/
body: MarkdownString;
/**
* The display name of the user who created the comment
*/
userName: string;
gravatar: string;
/**
* The icon path for the user who created the comment
*/
userIconPath?: Uri;
/**
* @deprecated Use userIconPath instead. The avatar src of the user who created the comment
*/
gravatar?: string;
/**
* Whether the current user has permission to edit the comment.
*
* This will be treated as false if the comment is provided by a `WorkspaceCommentProvider`, or
* if it is provided by a `DocumentCommentProvider` and no `editComment` method is given.
*/
canEdit?: boolean;
/**
* Whether the current user has permission to delete the comment.
*
* This will be treated as false if the comment is provided by a `WorkspaceCommentProvider`, or
* if it is provided by a `DocumentCommentProvider` and no `deleteComment` method is given.
*/
canDelete?: boolean;
/**
* The command to be executed if the comment is selected in the Comments Panel
*/
command?: Command;
isDraft?: boolean;
}
export interface CommentThreadChangedEvent {
@@ -545,21 +774,64 @@ declare module 'vscode' {
* Changed comment threads.
*/
readonly changed: CommentThread[];
/**
* Changed draft mode
*/
readonly inDraftMode: boolean;
}
interface DocumentCommentProvider {
/**
* Provide the commenting ranges and comment threads for the given document. The comments are displayed within the editor.
*/
provideDocumentComments(document: TextDocument, token: CancellationToken): Promise<CommentInfo>;
createNewCommentThread?(document: TextDocument, range: Range, text: string, token: CancellationToken): Promise<CommentThread>;
replyToCommentThread?(document: TextDocument, range: Range, commentThread: CommentThread, text: string, token: CancellationToken): Promise<CommentThread>;
onDidChangeCommentThreads?: Event<CommentThreadChangedEvent>;
/**
* Called when a user adds a new comment thread in the document at the specified range, with body text.
*/
createNewCommentThread(document: TextDocument, range: Range, text: string, token: CancellationToken): Promise<CommentThread>;
/**
* Called when a user replies to a new comment thread in the document at the specified range, with body text.
*/
replyToCommentThread(document: TextDocument, range: Range, commentThread: CommentThread, text: string, token: CancellationToken): Promise<CommentThread>;
/**
* Called when a user edits the comment body to the be new text.
*/
editComment?(document: TextDocument, comment: Comment, text: string, token: CancellationToken): Promise<void>;
/**
* Called when a user deletes the comment.
*/
deleteComment?(document: TextDocument, comment: Comment, token: CancellationToken): Promise<void>;
startDraft?(token: CancellationToken): Promise<void>;
deleteDraft?(token: CancellationToken): Promise<void>;
finishDraft?(token: CancellationToken): Promise<void>;
startDraftLabel?: string;
deleteDraftLabel?: string;
finishDraftLabel?: string;
/**
* Notify of updates to comment threads.
*/
onDidChangeCommentThreads: Event<CommentThreadChangedEvent>;
}
interface WorkspaceCommentProvider {
/**
* Provide all comments for the workspace. Comments are shown within the comments panel. Selecting a comment
* from the panel runs the comment's command.
*/
provideWorkspaceComments(token: CancellationToken): Promise<CommentThread[]>;
createNewCommentThread?(document: TextDocument, range: Range, text: string, token: CancellationToken): Promise<CommentThread>;
replyToCommentThread?(document: TextDocument, range: Range, commentThread: CommentThread, text: string, token: CancellationToken): Promise<CommentThread>;
onDidChangeCommentThreads?: Event<CommentThreadChangedEvent>;
/**
* Notify of updates to comment threads.
*/
onDidChangeCommentThreads: Event<CommentThreadChangedEvent>;
}
namespace workspace {
@@ -692,19 +964,6 @@ declare module 'vscode' {
}
export namespace window {
/**
* The currently active terminal or `undefined`. The active terminal is the one that
* currently has focus or most recently had focus.
*/
export const activeTerminal: Terminal | undefined;
/**
* An [event](#Event) which fires when the [active terminal](#window.activeTerminal)
* has changed. *Note* that the event also fires when the active terminal changes
* to `undefined`.
*/
export const onDidChangeActiveTerminal: Event<Terminal | undefined>;
/**
* Create a [TerminalRenderer](#TerminalRenderer).
*
@@ -740,4 +999,71 @@ declare module 'vscode' {
export const onDidRenameFile: Event<FileRenameEvent>;
}
//#endregion
//#region Alex - OnEnter enhancement
export interface OnEnterRule {
/**
* This rule will only execute if the text above the this line matches this regular expression.
*/
oneLineAboveText?: RegExp;
}
//#endregion
//#region Tree View
export interface TreeView<T> {
/**
* An optional human-readable message that will be rendered in the view.
*/
message?: string | MarkdownString;
}
/**
* Label describing the [Tree item](#TreeItem)
*/
export interface TreeItemLabel {
/**
* A human-readable string describing the [Tree item](#TreeItem).
*/
label: string;
/**
* Ranges in the label to highlight. A range is defined as a tuple of two number where the
* first is the inclusive start index and the second the exclusive end index
*/
highlights?: [number, number][];
}
export class TreeItem2 extends TreeItem {
/**
* Label describing this item. When `falsy`, it is derived from [resourceUri](#TreeItem.resourceUri).
*/
label?: string | TreeItemLabel | /* for compilation */ any;
/**
* @param label Label describing this item
* @param collapsibleState [TreeItemCollapsibleState](#TreeItemCollapsibleState) of the tree item. Default is [TreeItemCollapsibleState.None](#TreeItemCollapsibleState.None)
*/
constructor(label: TreeItemLabel, collapsibleState?: TreeItemCollapsibleState);
}
//#endregion
//#region Extension Context
export interface ExtensionContext {
/**
* An absolute file path in which the extension can store gloabal state.
* The directory might not exist on disk and creation is
* up to the extension. However, the parent directory is guaranteed to be existent.
*
* Use [`globalState`](#ExtensionContext.globalState) to store key value data.
*/
globalStoragePath: string;
}
//#endregion
}