Merge VS Code 1.21 source code (#1067)

* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

* fix select box issues where the list doesn't show up

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
This commit is contained in:
Karl Burtram
2018-04-04 15:27:51 -07:00
committed by GitHub
parent 5fba3e31b4
commit dafb780987
9412 changed files with 141255 additions and 98813 deletions

View File

@@ -7,6 +7,63 @@
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 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.
@@ -83,12 +140,33 @@ declare module 'vscode' {
type: FileType;
}
export interface TextSearchQuery {
pattern: string;
isRegex?: boolean;
isCaseSensitive?: boolean;
isWordMatch?: boolean;
}
export interface TextSearchOptions {
includes: GlobPattern[];
excludes: GlobPattern[];
}
export interface TextSearchResult {
uri: Uri;
range: Range;
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 {
onDidChange?: Event<FileChange[]>;
readonly onDidChange?: Event<FileChange[]>;
root: Uri;
// todo@joh - remove this
readonly root?: Uri;
// more...
//
@@ -98,6 +176,7 @@ declare module 'vscode' {
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
@@ -128,11 +207,13 @@ declare module 'vscode' {
// 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>;
provideTextSearchResults?(query: TextSearchQuery, options: TextSearchOptions, progress: Progress<TextSearchResult>, token: CancellationToken): Thenable<void>;
}
export namespace workspace {
export function registerFileSystemProvider(authority: string, provider: FileSystemProvider): Disposable;
export function registerFileSystemProvider(scheme: string, provider: FileSystemProvider): Disposable;
}
export namespace window {
@@ -198,120 +279,361 @@ declare module 'vscode' {
//#endregion
// {{SQL CARBON EDIT}}
// remove debug namespace
/**
* Represents an action that can be performed in code.
*
* Shown using the [light bulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action)
* The severity level of a log message
*/
export class CodeAction {
export enum LogLevel {
Trace = 1,
Debug = 2,
Info = 3,
Warning = 4,
Error = 5,
Critical = 6,
Off = 7
}
/**
* 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;
warn(message: string, ...args: any[]): void;
error(message: string | Error, ...args: any[]): void;
critical(message: string | Error, ...args: any[]): void;
}
export interface ExtensionContext {
/**
* Label used to identify the code action in UI.
* This extension's logger
*/
logger: Logger;
}
export interface RenameInitialValue {
range: Range;
text?: string;
}
export namespace languages {
/**
* Register a folding provider.
*
* 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.
*/
export function registerFoldingProvider(selector: DocumentSelector, provider: FoldingProvider): Disposable;
export interface RenameProvider2 extends RenameProvider {
resolveInitialRenameValue?(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<RenameInitialValue>;
}
}
export interface FoldingProvider {
provideFoldingRanges(document: TextDocument, token: CancellationToken): ProviderResult<FoldingRangeList>;
}
/**
* Represents the validation type of the Source Control input.
*/
export enum SourceControlInputBoxValidationType {
/**
* Something not allowed by the rules of a language or other means.
*/
Error = 0,
/**
* Something suspicious but allowed.
*/
Warning = 1,
/**
* Something to inform about but not a problem.
*/
Information = 2
}
export interface SourceControlInputBoxValidation {
/**
* The validation message to display.
*/
readonly message: string;
/**
* The validation type.
*/
readonly type: SourceControlInputBoxValidationType;
}
/**
* Represents the input box in the Source Control viewlet.
*/
export interface SourceControlInputBox {
/**
* A validation function for the input box. It's possible to change
* the validation provider simply by setting this property to a different function.
*/
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;
/**
* 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[];
}
/**
* A webview is an editor with html content, like an iframe.
*/
export interface Webview {
/**
* 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;
/**
* Optional command that performs the code action.
* Contents of the webview.
*
* Executed after `edits` if any edits are provided. Either `command` or `edits` must be provided for a `CodeAction`.
* Should be a complete html document.
*/
command?: Command;
html: string;
/**
* Optional edit that performs the code action.
*
* Either `command` or `edits` must be provided for a `CodeAction`.
* The column in which the webview is showing.
*/
edits?: TextEdit[] | WorkspaceEdit;
readonly viewColumn?: ViewColumn;
/**
* Diagnostics that this code action resolves.
* Fired when the webview content posts a message.
*/
diagnostics?: Diagnostic[];
readonly onDidReceiveMessage: Event<any>;
constructor(title: string, edits?: TextEdit[] | WorkspaceEdit);
/**
* 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.
*
* Messages are only develivered if the webview is visible.
*
* @param message Body of the message.
*/
postMessage(message: any): Thenable<boolean>;
/**
* Shows the webview in a given column.
*
* 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.
*
* 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.
*/
dispose(): any;
}
export interface CodeActionProvider {
export interface TextEditor {
/**
* Provide commands for the given document and range.
*
* If implemented, overrides `provideCodeActions`
*
* @param document The document in which the command was invoked.
* @param range The range for which the command was invoked.
* @param context Context carrying additional information.
* @param token A cancellation token.
* @return An array of commands, quick fixes, or refactorings or a thenable of such. The lack of a result can be
* signaled by returning `undefined`, `null`, or an empty array.
* Type identifying the editor as a text editor.
*/
provideCodeActions2?(document: TextDocument, range: Range, context: CodeActionContext, token: CancellationToken): ProviderResult<(Command | CodeAction)[]>;
readonly editorType: 'texteditor';
}
// {{SQL CARBON EDIT}}
// remove debug namespace
/**
* An event describing a change to the set of [breakpoints](#debug.Breakpoint).
*/
export interface BreakpointsChangeEvent {
namespace window {
/**
* Added breakpoints.
* Create and show a new webview.
*
* @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.
*/
readonly added: Breakpoint[];
export function createWebview(uri: Uri, title: string, column: ViewColumn, options: WebviewOptions): Webview;
/**
* Removed breakpoints.
* Event fired when the active editor changes.
*/
readonly removed: Breakpoint[];
export const onDidChangeActiveEditor: Event<TextEditor | Webview | undefined>;
}
export namespace window {
/**
* Changed breakpoints.
* 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.
*/
readonly changed: Breakpoint[];
export function registerTreeDataProvider<T>(viewId: string, treeDataProvider: TreeDataProvider<T>): TreeView<T>;
}
/**
* The base class of all breakpoint types.
* Represents a Tree view
*/
export class Breakpoint {
/**
* Is breakpoint enabled.
*/
readonly enabled: boolean;
/**
* An optional expression for conditional breakpoints.
*/
readonly condition?: string;
/**
* An optional expression that controls how many hits of the breakpoint are ignored.
*/
readonly hitCondition?: string;
export interface TreeView<T> extends Disposable {
protected constructor(enabled: boolean, condition: string, hitCondition: string);
/**
* 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>;
}
/**
* A breakpoint specified by a source location.
* A data provider that provides tree data
*/
export class SourceBreakpoint extends Breakpoint {
export interface TreeDataProvider<T> {
/**
* The source and line position of this breakpoint.
* 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`.
*/
readonly location: Location;
onDidChangeTreeData?: Event<T | undefined | null>;
private constructor(enabled: boolean, condition: string, hitCondition: string, location: Location);
/**
* 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>;
}
//#region TextEditor.visibleRange and related event
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[];
}
/**
* A breakpoint specified by a function name.
* Represents an event describing the change in a [text editor's visible ranges](#TextEditor.visibleRanges).
*/
export class FunctionBreakpoint extends Breakpoint {
export interface TextEditorVisibleRangesChangeEvent {
/**
* The name of the function to which this breakpoint is attached.
* The [text editor](#TextEditor) for which the visible ranges have changed.
*/
readonly functionName: string;
private constructor(enabled: boolean, condition: string, hitCondition: string, functionName: string);
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>;
}
//#endregion
}