mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
update reps
This commit is contained in:
12
tree-view-sample/package-lock.json
generated
12
tree-view-sample/package-lock.json
generated
@ -57,9 +57,9 @@
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "7.0.18",
|
||||
"resolved": false,
|
||||
"integrity": "sha1-zWfyfT3Az7dG8L3V4IbExdVb4XM=",
|
||||
"version": "10.14.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.12.tgz",
|
||||
"integrity": "sha512-QcAKpaO6nhHLlxWBvpc4WeLrTvPqlHOvaj0s5GriKkA1zq+bsFBPpfYCvQhLqLgYlIko8A9YrPdaMHCo5mBcpg==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/rimraf": {
|
||||
@ -73,9 +73,9 @@
|
||||
}
|
||||
},
|
||||
"@types/vscode": {
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.33.0.tgz",
|
||||
"integrity": "sha512-JSmGiValbrcG5g20jjCfKakLiuWyrcjVezj+SEAEZ4klXQktE5EtowuGlkLVqbkiBK4iY5wy/4yW8OjecuHnjQ==",
|
||||
"version": "1.36.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.36.0.tgz",
|
||||
"integrity": "sha512-SbHR3Q5g/C3N+Ila3KrRf1rSZiyHxWdOZ7X3yFHXzw6HrvRLuVZrxnwEX0lTBMRpH9LkwZdqRTgXW+D075jxkg==",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
|
||||
@ -205,16 +205,15 @@
|
||||
"scripts": {
|
||||
"vscode:prepublish": "npm run compile",
|
||||
"compile": "tsc -p ./",
|
||||
"lint": "tslint -p ./",
|
||||
"watch": "tsc -watch -p ./"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mkdirp": "^0.5.2",
|
||||
"@types/node": "*",
|
||||
"@types/node": "^10.12.21",
|
||||
"@types/rimraf": "^2.0.2",
|
||||
"tslint": "^5.16.0",
|
||||
"@types/vscode": "^1.36.0",
|
||||
"typescript": "^3.5.1",
|
||||
"@types/vscode": "^1.32.0"
|
||||
"tslint": "^5.12.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"jsonc-parser": "^0.4.2",
|
||||
|
||||
627
tree-view-sample/vscode.proposed.d.ts
vendored
627
tree-view-sample/vscode.proposed.d.ts
vendored
@ -16,6 +16,17 @@
|
||||
|
||||
declare module 'vscode' {
|
||||
|
||||
//#region Joh - ExecutionContext
|
||||
// THIS is a deprecated proposal
|
||||
export enum ExtensionExecutionContext {
|
||||
Local = 1,
|
||||
Remote = 2
|
||||
}
|
||||
export interface ExtensionContext {
|
||||
executionContext: ExtensionExecutionContext;
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region Joh - call hierarchy
|
||||
|
||||
export enum CallHierarchyDirection {
|
||||
@ -42,7 +53,7 @@ declare module 'vscode' {
|
||||
*/
|
||||
provideCallHierarchyItem(
|
||||
document: TextDocument,
|
||||
postion: Position,
|
||||
position: Position,
|
||||
token: CancellationToken
|
||||
): ProviderResult<CallHierarchyItem>;
|
||||
|
||||
@ -119,32 +130,21 @@ declare module 'vscode' {
|
||||
|
||||
// #region Joh - code insets
|
||||
|
||||
/**
|
||||
*/
|
||||
export class CodeInset {
|
||||
range: Range;
|
||||
height?: number;
|
||||
constructor(range: Range, height?: number);
|
||||
export interface WebviewEditorInset {
|
||||
readonly editor: TextEditor;
|
||||
readonly line: number;
|
||||
readonly height: number;
|
||||
readonly webview: Webview;
|
||||
readonly onDidDispose: Event<void>;
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
export interface CodeInsetProvider {
|
||||
onDidChangeCodeInsets?: Event<void>;
|
||||
provideCodeInsets(document: TextDocument, token: CancellationToken): ProviderResult<CodeInset[]>;
|
||||
resolveCodeInset(codeInset: CodeInset, webview: Webview, token: CancellationToken): ProviderResult<CodeInset>;
|
||||
}
|
||||
|
||||
export namespace languages {
|
||||
|
||||
/**
|
||||
* Register a code inset provider.
|
||||
*
|
||||
*/
|
||||
export function registerCodeInsetProvider(selector: DocumentSelector, provider: CodeInsetProvider): Disposable;
|
||||
export namespace window {
|
||||
export function createWebviewTextEditorInset(editor: TextEditor, line: number, height: number, options?: WebviewOptions): WebviewEditorInset;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
|
||||
//#region Joh - read/write in chunks
|
||||
|
||||
export interface FileSystemProvider {
|
||||
@ -735,102 +735,10 @@ declare module 'vscode' {
|
||||
inDraftMode?: boolean;
|
||||
}
|
||||
|
||||
export enum CommentThreadCollapsibleState {
|
||||
/**
|
||||
* Determines an item is collapsed
|
||||
*/
|
||||
Collapsed = 0,
|
||||
/**
|
||||
* Determines an item is expanded
|
||||
*/
|
||||
Expanded = 1
|
||||
}
|
||||
|
||||
/**
|
||||
* A collection of comments representing a conversation at a particular range in a document.
|
||||
*/
|
||||
export 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 human-readable label describing the [Comment Thread](#CommentThread)
|
||||
*/
|
||||
label?: string;
|
||||
|
||||
/**
|
||||
* The ordered comments of the thread.
|
||||
*/
|
||||
comments: Comment[];
|
||||
|
||||
/**
|
||||
* Optional accept input command
|
||||
*
|
||||
* `acceptInputCommand` is the default action rendered on Comment Widget, which is always placed rightmost.
|
||||
* This command will be invoked when users the user accepts the value in the comment editor.
|
||||
* This command will disabled when the comment editor is empty.
|
||||
*/
|
||||
acceptInputCommand?: Command;
|
||||
|
||||
/**
|
||||
* Optional additonal commands.
|
||||
*
|
||||
* `additionalCommands` are the secondary actions rendered on Comment Widget.
|
||||
*/
|
||||
additionalCommands?: Command[];
|
||||
|
||||
/**
|
||||
* Whether the thread should be collapsed or expanded when opening the document.
|
||||
* Defaults to Collapsed.
|
||||
*/
|
||||
collapsibleState?: CommentThreadCollapsibleState;
|
||||
|
||||
/**
|
||||
* The command to be executed when users try to delete the comment thread. Currently, this is only called
|
||||
* when the user collapses a comment thread that has no comments in it.
|
||||
*/
|
||||
deleteCommand?: Command;
|
||||
|
||||
/**
|
||||
* Dispose this comment thread.
|
||||
* Once disposed, the comment thread will be removed from visible text editors and Comments Panel.
|
||||
*/
|
||||
dispose?(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A comment is displayed within the editor or the Comments Panel, depending on how it is provided.
|
||||
*/
|
||||
export interface Comment {
|
||||
/**
|
||||
* The id of the comment
|
||||
*/
|
||||
readonly commentId: string;
|
||||
|
||||
/**
|
||||
* The text of the comment
|
||||
*/
|
||||
readonly body: MarkdownString;
|
||||
|
||||
/**
|
||||
* Optional label describing the [Comment](#Comment)
|
||||
* Label will be rendered next to userName if exists.
|
||||
*/
|
||||
readonly label?: string;
|
||||
|
||||
/**
|
||||
* The display name of the user who created the comment
|
||||
*/
|
||||
@ -841,6 +749,13 @@ declare module 'vscode' {
|
||||
*/
|
||||
readonly userIconPath?: Uri;
|
||||
|
||||
/**
|
||||
* The id of the comment
|
||||
*
|
||||
* @deprecated Use Id instead
|
||||
*/
|
||||
readonly commentId: string;
|
||||
|
||||
/**
|
||||
* @deprecated Use userIconPath instead. The avatar src of the user who created the comment
|
||||
*/
|
||||
@ -873,24 +788,14 @@ declare module 'vscode' {
|
||||
command?: Command;
|
||||
|
||||
/**
|
||||
* The command to be executed if the comment is selected in the Comments Panel
|
||||
* Deprecated
|
||||
*/
|
||||
readonly selectCommand?: Command;
|
||||
|
||||
/**
|
||||
* The command to be executed when users try to save the edits to the comment
|
||||
*/
|
||||
readonly editCommand?: Command;
|
||||
isDraft?: boolean;
|
||||
|
||||
/**
|
||||
* The command to be executed when users try to delete the comment
|
||||
*/
|
||||
readonly deleteCommand?: Command;
|
||||
|
||||
/**
|
||||
* Deprecated
|
||||
*/
|
||||
isDraft?: boolean;
|
||||
deleteCommand?: Command;
|
||||
|
||||
/**
|
||||
* Proposed Comment Reaction
|
||||
@ -905,17 +810,17 @@ declare module 'vscode' {
|
||||
/**
|
||||
* Added comment threads.
|
||||
*/
|
||||
readonly added: CommentThread[];
|
||||
readonly added: ReadonlyArray<CommentThread>;
|
||||
|
||||
/**
|
||||
* Removed comment threads.
|
||||
*/
|
||||
readonly removed: CommentThread[];
|
||||
readonly removed: ReadonlyArray<CommentThread>;
|
||||
|
||||
/**
|
||||
* Changed comment threads.
|
||||
*/
|
||||
readonly changed: CommentThread[];
|
||||
readonly changed: ReadonlyArray<CommentThread>;
|
||||
|
||||
/**
|
||||
* Changed draft mode
|
||||
@ -925,11 +830,9 @@ declare module 'vscode' {
|
||||
|
||||
/**
|
||||
* Comment Reactions
|
||||
* Stay in proposed.
|
||||
*/
|
||||
interface CommentReaction {
|
||||
readonly label?: string;
|
||||
readonly iconPath?: string | Uri;
|
||||
count?: number;
|
||||
readonly hasReacted?: boolean;
|
||||
}
|
||||
|
||||
@ -997,73 +900,40 @@ declare module 'vscode' {
|
||||
}
|
||||
|
||||
/**
|
||||
* The comment input box in Comment Widget.
|
||||
* Stay in proposed
|
||||
*/
|
||||
export interface CommentInputBox {
|
||||
/**
|
||||
* Setter and getter for the contents of the comment input box.
|
||||
*/
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface CommentReactionProvider {
|
||||
availableReactions: CommentReaction[];
|
||||
toggleReaction?(document: TextDocument, comment: Comment, reaction: CommentReaction): Promise<void>;
|
||||
}
|
||||
|
||||
export interface CommentingRangeProvider {
|
||||
export interface CommentThread {
|
||||
/**
|
||||
* Provide a list of ranges which allow new comment threads creation or null for a given document
|
||||
* The uri of the document the thread has been created on.
|
||||
*/
|
||||
provideCommentingRanges(document: TextDocument, token: CancellationToken): ProviderResult<Range[]>;
|
||||
readonly resource: Uri;
|
||||
|
||||
/**
|
||||
* The method `createEmptyCommentThread` is called when users attempt to create new comment thread from the gutter or command palette.
|
||||
* Extensions still need to call `createCommentThread` inside this call when appropriate.
|
||||
* Optional additonal commands.
|
||||
*
|
||||
* `additionalCommands` are the secondary actions rendered on Comment Widget.
|
||||
*/
|
||||
createEmptyCommentThread(document: TextDocument, range: Range): ProviderResult<void>;
|
||||
additionalCommands?: Command[];
|
||||
|
||||
/**
|
||||
* The command to be executed when users try to delete the comment thread. Currently, this is only called
|
||||
* when the user collapses a comment thread that has no comments in it.
|
||||
*/
|
||||
deleteCommand?: Command;
|
||||
}
|
||||
|
||||
|
||||
export interface CommentController {
|
||||
/**
|
||||
* The id of this comment controller.
|
||||
*/
|
||||
readonly id: string;
|
||||
|
||||
/**
|
||||
* The human-readable label of this comment controller.
|
||||
*/
|
||||
readonly label: string;
|
||||
|
||||
/**
|
||||
* The active (focused) [comment input box](#CommentInputBox).
|
||||
*/
|
||||
readonly inputBox?: CommentInputBox;
|
||||
|
||||
/**
|
||||
* Create a [CommentThread](#CommentThread)
|
||||
*/
|
||||
createCommentThread(id: string, resource: Uri, range: Range, comments: Comment[]): CommentThread;
|
||||
|
||||
/**
|
||||
* Optional commenting range provider.
|
||||
* Provide a list [ranges](#Range) which support commenting to any given resource uri.
|
||||
*/
|
||||
commentingRangeProvider?: CommentingRangeProvider;
|
||||
|
||||
/**
|
||||
* Optional reaction provider
|
||||
* Stay in proposed.
|
||||
*/
|
||||
reactionProvider?: CommentReactionProvider;
|
||||
|
||||
/**
|
||||
* Dispose this comment controller.
|
||||
*/
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
namespace comment {
|
||||
export function createCommentController(id: string, label: string): CommentController;
|
||||
}
|
||||
|
||||
namespace workspace {
|
||||
@ -1079,6 +949,131 @@ declare module 'vscode' {
|
||||
export function registerWorkspaceCommentProvider(provider: WorkspaceCommentProvider): Disposable;
|
||||
}
|
||||
|
||||
/**
|
||||
* A collection of [comments](#Comment) representing a conversation at a particular range in a document.
|
||||
*/
|
||||
export interface CommentThread {
|
||||
/**
|
||||
* A unique identifier of the comment thread.
|
||||
*/
|
||||
readonly id: string;
|
||||
|
||||
/**
|
||||
* The uri of the document the thread has been created on.
|
||||
*/
|
||||
readonly uri: Uri;
|
||||
|
||||
/**
|
||||
* Optional accept input command
|
||||
*
|
||||
* `acceptInputCommand` is the default action rendered on Comment Widget, which is always placed rightmost.
|
||||
* This command will be invoked when users the user accepts the value in the comment editor.
|
||||
* This command will disabled when the comment editor is empty.
|
||||
*/
|
||||
acceptInputCommand?: Command;
|
||||
}
|
||||
|
||||
/**
|
||||
* A comment is displayed within the editor or the Comments Panel, depending on how it is provided.
|
||||
*/
|
||||
export interface Comment {
|
||||
/**
|
||||
* The id of the comment
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The command to be executed if the comment is selected in the Comments Panel
|
||||
*/
|
||||
selectCommand?: Command;
|
||||
|
||||
/**
|
||||
* The command to be executed when users try to save the edits to the comment
|
||||
*/
|
||||
editCommand?: Command;
|
||||
}
|
||||
|
||||
/**
|
||||
* The comment input box in Comment Widget.
|
||||
*/
|
||||
export interface CommentInputBox {
|
||||
/**
|
||||
* Setter and getter for the contents of the comment input box
|
||||
*/
|
||||
value: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Commenting range provider for a [comment controller](#CommentController).
|
||||
*/
|
||||
export interface CommentingRangeProvider {
|
||||
/**
|
||||
* Provide a list of ranges which allow new comment threads creation or null for a given document
|
||||
*/
|
||||
provideCommentingRanges(document: TextDocument, token: CancellationToken): ProviderResult<Range[]>;
|
||||
}
|
||||
|
||||
export interface EmptyCommentThreadFactory {
|
||||
/**
|
||||
* The method `createEmptyCommentThread` is called when users attempt to create new comment thread from the gutter or command palette.
|
||||
* Extensions still need to call `createCommentThread` inside this call when appropriate.
|
||||
*/
|
||||
createEmptyCommentThread(document: TextDocument, range: Range): ProviderResult<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A comment controller is able to provide [comments](#CommentThread) support to the editor and
|
||||
* provide users various ways to interact with comments.
|
||||
*/
|
||||
export interface CommentController {
|
||||
|
||||
/**
|
||||
* The active [comment input box](#CommentInputBox) or `undefined`. The active `inputBox` is the input box of
|
||||
* the comment thread widget that currently has focus. It's `undefined` when the focus is not in any CommentInputBox.
|
||||
*/
|
||||
readonly inputBox?: CommentInputBox;
|
||||
|
||||
/**
|
||||
* Create a [comment thread](#CommentThread). The comment thread will be displayed in visible text editors (if the resource matches)
|
||||
* and Comments Panel once created.
|
||||
*
|
||||
* @param id An `id` for the comment thread.
|
||||
* @param resource The uri of the document the thread has been created on.
|
||||
* @param range The range the comment thread is located within the document.
|
||||
* @param comments The ordered comments of the thread.
|
||||
*/
|
||||
createCommentThread(id: string, resource: Uri, range: Range, comments: Comment[]): CommentThread;
|
||||
|
||||
/**
|
||||
* Optional new comment thread factory.
|
||||
*/
|
||||
emptyCommentThreadFactory?: EmptyCommentThreadFactory;
|
||||
|
||||
/**
|
||||
* Optional reaction provider
|
||||
*/
|
||||
reactionProvider?: CommentReactionProvider;
|
||||
|
||||
/**
|
||||
* Dispose this comment controller.
|
||||
*
|
||||
* Once disposed, all [comment threads](#CommentThread) created by this comment controller will also be removed from the editor
|
||||
* and Comments Panel.
|
||||
*/
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
namespace comment {
|
||||
/**
|
||||
* Creates a new [comment controller](#CommentController) instance.
|
||||
*
|
||||
* @param id An `id` for the comment controller.
|
||||
* @param label A human-readable string for the comment controller.
|
||||
* @return An instance of [comment controller](#CommentController).
|
||||
*/
|
||||
export function createCommentController(id: string, label: string): CommentController;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Terminal
|
||||
@ -1120,6 +1115,18 @@ declare module 'vscode' {
|
||||
readonly onDidWriteData: Event<string>;
|
||||
}
|
||||
|
||||
|
||||
export interface TerminalOptions {
|
||||
/**
|
||||
* When enabled the terminal will run the process as normal but not be surfaced to the user
|
||||
* until `Terminal.show` is called. The typical usage for this is when you need to run
|
||||
* something that may need interactivity but only want to tell the user about it when
|
||||
* interaction is needed. Note that the terminals will still be exposed to all extensions
|
||||
* as normal.
|
||||
*/
|
||||
runInBackground?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the dimensions of a terminal.
|
||||
*/
|
||||
@ -1149,6 +1156,8 @@ declare module 'vscode' {
|
||||
* [Terminal.sendText](#Terminal.sendText) is triggered that will fire the
|
||||
* [TerminalRenderer.onDidAcceptInput](#TerminalRenderer.onDidAcceptInput) event.
|
||||
*
|
||||
* @deprecated Use [virtual processes](#TerminalVirtualProcess) instead.
|
||||
*
|
||||
* **Example:** Create a terminal renderer, show it and write hello world in red
|
||||
* ```typescript
|
||||
* const renderer = window.createTerminalRenderer('foo');
|
||||
@ -1159,6 +1168,7 @@ declare module 'vscode' {
|
||||
export interface TerminalRenderer {
|
||||
/**
|
||||
* The name of the terminal, this will appear in the terminal selector.
|
||||
* @deprecated Use [virtual processes](#TerminalVirtualProcess) instead.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
@ -1167,6 +1177,8 @@ declare module 'vscode' {
|
||||
* a value smaller than the maximum value, if this is undefined the terminal will auto fit
|
||||
* to the maximum value [maximumDimensions](TerminalRenderer.maximumDimensions).
|
||||
*
|
||||
* @deprecated Use [virtual processes](#TerminalVirtualProcess) instead.
|
||||
*
|
||||
* **Example:** Override the dimensions of a TerminalRenderer to 20 columns and 10 rows
|
||||
* ```typescript
|
||||
* terminalRenderer.dimensions = {
|
||||
@ -1182,11 +1194,15 @@ declare module 'vscode' {
|
||||
* terminal renderer is created and also until the terminal becomes visible in the UI.
|
||||
* Listen to [onDidChangeMaximumDimensions](TerminalRenderer.onDidChangeMaximumDimensions)
|
||||
* to get notified when this value changes.
|
||||
*
|
||||
* @deprecated Use [virtual processes](#TerminalVirtualProcess) instead.
|
||||
*/
|
||||
readonly maximumDimensions: TerminalDimensions | undefined;
|
||||
|
||||
/**
|
||||
* The corresponding [Terminal](#Terminal) for this TerminalRenderer.
|
||||
*
|
||||
* @deprecated Use [virtual processes](#TerminalVirtualProcess) instead.
|
||||
*/
|
||||
readonly terminal: Terminal;
|
||||
|
||||
@ -1194,6 +1210,9 @@ declare module 'vscode' {
|
||||
* Write text to the terminal. Unlike [Terminal.sendText](#Terminal.sendText) which sends
|
||||
* text to the underlying _process_, this will write the text to the terminal itself.
|
||||
*
|
||||
* @param text The text to write.
|
||||
* @deprecated Use [virtual processes](#TerminalVirtualProcess) instead.
|
||||
*
|
||||
* **Example:** Write red text to the terminal
|
||||
* ```typescript
|
||||
* terminalRenderer.write('\x1b[31mHello world\x1b[0m');
|
||||
@ -1203,8 +1222,6 @@ declare module 'vscode' {
|
||||
* ```typescript
|
||||
* terminalRenderer.write('\x1b[10;20H*');
|
||||
* ```
|
||||
*
|
||||
* @param text The text to write.
|
||||
*/
|
||||
write(text: string): void;
|
||||
|
||||
@ -1213,6 +1230,8 @@ declare module 'vscode' {
|
||||
* [Terminal.sendText](#Terminal.sendText). Keystrokes are converted into their
|
||||
* corresponding VT sequence representation.
|
||||
*
|
||||
* @deprecated Use [virtual processes](#TerminalVirtualProcess) instead.
|
||||
*
|
||||
* **Example:** Simulate interaction with the terminal from an outside extension or a
|
||||
* workbench command such as `workbench.action.terminal.runSelectedText`
|
||||
* ```typescript
|
||||
@ -1228,6 +1247,8 @@ declare module 'vscode' {
|
||||
/**
|
||||
* An event which fires when the [maximum dimensions](#TerminalRenderer.maximumDimensions) of
|
||||
* the terminal renderer change.
|
||||
*
|
||||
* @deprecated Use [virtual processes](#TerminalVirtualProcess) instead.
|
||||
*/
|
||||
readonly onDidChangeMaximumDimensions: Event<TerminalDimensions>;
|
||||
}
|
||||
@ -1237,12 +1258,146 @@ declare module 'vscode' {
|
||||
* Create a [TerminalRenderer](#TerminalRenderer).
|
||||
*
|
||||
* @param name The name of the terminal renderer, this shows up in the terminal selector.
|
||||
* @deprecated Use [virtual processes](#TerminalVirtualProcess) instead.
|
||||
*/
|
||||
export function createTerminalRenderer(name: string): TerminalRenderer;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Terminal virtual process
|
||||
|
||||
export namespace window {
|
||||
/**
|
||||
* Creates a [Terminal](#Terminal) where an extension acts as the process.
|
||||
*
|
||||
* @param options A [TerminalVirtualProcessOptions](#TerminalVirtualProcessOptions) object describing the
|
||||
* characteristics of the new terminal.
|
||||
* @return A new Terminal.
|
||||
*/
|
||||
export function createTerminal(options: TerminalVirtualProcessOptions): Terminal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Value-object describing what options a virtual process terminal should use.
|
||||
*/
|
||||
export interface TerminalVirtualProcessOptions {
|
||||
/**
|
||||
* A human-readable string which will be used to represent the terminal in the UI.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* An implementation of [TerminalVirtualProcess](#TerminalVirtualProcess) that allows an
|
||||
* extension to act as a terminal's backing process.
|
||||
*/
|
||||
virtualProcess: TerminalVirtualProcess;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the interface of a terminal virtual process, enabling extensions to act as a process
|
||||
* in the terminal.
|
||||
*/
|
||||
interface TerminalVirtualProcess {
|
||||
/**
|
||||
* An event that when fired will write data to the terminal. Unlike
|
||||
* [Terminal.sendText](#Terminal.sendText) which sends text to the underlying _process_,
|
||||
* this will write the text to the terminal itself.
|
||||
*
|
||||
* **Example:** Write red text to the terminal
|
||||
* ```typescript
|
||||
* const writeEmitter = new vscode.EventEmitter<string>();
|
||||
* const virtualProcess: TerminalVirtualProcess = {
|
||||
* onDidWrite: writeEmitter.event
|
||||
* };
|
||||
* vscode.window.createTerminal({ name: 'My terminal', virtualProcess });
|
||||
* writeEmitter.fire('\x1b[31mHello world\x1b[0m');
|
||||
* ```
|
||||
*
|
||||
* **Example:** Move the cursor to the 10th row and 20th column and write an asterisk
|
||||
* ```typescript
|
||||
* writeEmitter.fire('\x1b[10;20H*');
|
||||
* ```
|
||||
*/
|
||||
onDidWrite: Event<string>;
|
||||
|
||||
/**
|
||||
* An event that when fired allows overriding the [dimensions](#Terminal.dimensions) of the
|
||||
* terminal. Note that when set the overridden dimensions will only take effect when they
|
||||
* are lower than the actual dimensions of the terminal (ie. there will never be a scroll
|
||||
* bar). Set to `undefined` for the terminal to go back to the regular dimensions.
|
||||
*
|
||||
* **Example:** Override the dimensions of a terminal to 20 columns and 10 rows
|
||||
* ```typescript
|
||||
* const dimensionsEmitter = new vscode.EventEmitter<string>();
|
||||
* const virtualProcess: TerminalVirtualProcess = {
|
||||
* onDidWrite: writeEmitter.event,
|
||||
* onDidOverrideDimensions: dimensionsEmitter.event
|
||||
* };
|
||||
* vscode.window.createTerminal({ name: 'My terminal', virtualProcess });
|
||||
* dimensionsEmitter.fire({
|
||||
* columns: 20,
|
||||
* rows: 10
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
onDidOverrideDimensions?: Event<TerminalDimensions | undefined>;
|
||||
|
||||
/**
|
||||
* An event that when fired will exit the process with an exit code, this will behave the
|
||||
* same for a virtual process as when a regular process exits with an exit code.
|
||||
*
|
||||
* **Example:** Exit with an exit code of `0` if the y key is pressed, otherwise `1`.
|
||||
* ```typescript
|
||||
* const writeEmitter = new vscode.EventEmitter<string>();
|
||||
* const exitEmitter = new vscode.EventEmitter<number>();
|
||||
* const virtualProcess: TerminalVirtualProcess = {
|
||||
* onDidWrite: writeEmitter.event,
|
||||
* input: data => exitEmitter.fire(data === 'y' ? 0 : 1)
|
||||
* };
|
||||
* vscode.window.createTerminal({ name: 'Exit example', virtualProcess });
|
||||
* writeEmitter.fire('Press y to exit successfully');
|
||||
*/
|
||||
onDidExit?: Event<number>;
|
||||
|
||||
/**
|
||||
* Implement to handle keystrokes in the terminal or when an extension calls
|
||||
* [Terminal.sendText](#Terminal.sendText). Keystrokes are converted into their
|
||||
* corresponding VT sequence representation.
|
||||
*
|
||||
* @param data The sent data.
|
||||
*
|
||||
* **Example:** Echo input in the terminal. The sequence for enter (`\r`) is translated to
|
||||
* CRLF to go to a new line and move the cursor to the start of the line.
|
||||
* ```typescript
|
||||
* const writeEmitter = new vscode.EventEmitter<string>();
|
||||
* const virtualProcess: TerminalVirtualProcess = {
|
||||
* onDidWrite: writeEmitter.event,
|
||||
* input: data => writeEmitter.fire(data === '\r' ? '\r\n' : data)
|
||||
* };
|
||||
* vscode.window.createTerminal({ name: 'Local echo', virtualProcess });
|
||||
* ```
|
||||
*/
|
||||
input?(data: string): void;
|
||||
|
||||
/**
|
||||
* Implement to handle when the number of rows and columns that fit into the terminal panel
|
||||
* changes, for example when font size changes or when the panel is resized. The initial
|
||||
* state of a terminal's dimensions should be treated as `undefined` until this is triggered
|
||||
* as the size of a terminal isn't know until it shows up in the user interface.
|
||||
*
|
||||
* @param dimensions The new dimensions.
|
||||
*/
|
||||
setDimensions?(dimensions: TerminalDimensions): void;
|
||||
|
||||
/**
|
||||
* Implement to handle when the terminal shuts down by an act of the user.
|
||||
*/
|
||||
shutdown?(): void;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Joh -> exclusive document filters
|
||||
|
||||
export interface DocumentFilter {
|
||||
@ -1372,42 +1527,86 @@ declare module 'vscode' {
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region Workspace URI Ben
|
||||
// #region Ben - status bar item with ID and Name
|
||||
|
||||
export namespace workspace {
|
||||
export namespace window {
|
||||
|
||||
/**
|
||||
* The location of the workspace file, for example:
|
||||
*
|
||||
* `file:///Users/name/Development/myProject.code-workspace`
|
||||
*
|
||||
* or
|
||||
*
|
||||
* `untitled:1555503116870`
|
||||
*
|
||||
* for a workspace that is untitled and not yet saved.
|
||||
*
|
||||
* Depending on the workspace that is opened, the value will be:
|
||||
* * `undefined` when no workspace or a single folder is opened
|
||||
* * the path of the workspace file as `Uri` otherwise. if the workspace
|
||||
* is untitled, the returned URI will use the `untitled:` scheme
|
||||
*
|
||||
* The location can e.g. be used with the `vscode.openFolder` command to
|
||||
* open the workspace again after it has been closed.
|
||||
*
|
||||
* **Example:**
|
||||
* ```typescript
|
||||
* vscode.commands.executeCommand('vscode.openFolder', uriOfWorkspace);
|
||||
* ```
|
||||
*
|
||||
* **Note:** it is not advised to use `workspace.workspaceFile` to write
|
||||
* configuration data into the file. You can use `workspace.getConfiguration().update()`
|
||||
* for that purpose which will work both when a single folder is opened as
|
||||
* well as an untitled or saved workspace.
|
||||
* Options to configure the status bar item.
|
||||
*/
|
||||
export const workspaceFile: Uri | undefined;
|
||||
export interface StatusBarItemOptions {
|
||||
|
||||
/**
|
||||
* A unique identifier of the status bar item. The identifier
|
||||
* is for example used to allow a user to show or hide the
|
||||
* status bar item in the UI.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* A human readable name of the status bar item. The name is
|
||||
* for example used as a label in the UI to show or hide the
|
||||
* status bar item.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The alignment of the status bar item.
|
||||
*/
|
||||
alignment?: StatusBarAlignment;
|
||||
|
||||
/**
|
||||
* The priority of the status bar item. Higher value means the item should
|
||||
* be shown more to the left.
|
||||
*/
|
||||
priority?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a status bar [item](#StatusBarItem).
|
||||
*
|
||||
* @param options The options of the item. If not provided, some default values
|
||||
* will be assumed. For example, the `StatusBarItemOptions.id` will be the id
|
||||
* of the extension and the `StatusBarItemOptions.name` will be the extension name.
|
||||
* @return A new status bar item.
|
||||
*/
|
||||
export function createStatusBarItem(options?: StatusBarItemOptions): StatusBarItem;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
}
|
||||
//#region Webview Resource Roots
|
||||
|
||||
export interface Webview {
|
||||
/**
|
||||
* Root url from which local resources are loaded inside of webviews.
|
||||
*
|
||||
* This is `vscode-resource:` when vscode is run on the desktop. When vscode is run
|
||||
* on the web, this points to a server endpoint.
|
||||
*/
|
||||
readonly resourceRoot: Thenable<string>;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
|
||||
//#region Joh - read/write files of any scheme
|
||||
|
||||
export interface FileSystem {
|
||||
stat(uri: Uri): Thenable<FileStat>;
|
||||
readDirectory(uri: Uri): Thenable<[string, FileType][]>;
|
||||
createDirectory(uri: Uri): Thenable<void>;
|
||||
readFile(uri: Uri): Thenable<Uint8Array>;
|
||||
writeFile(uri: Uri, content: Uint8Array, options?: { create: boolean, overwrite: boolean }): Thenable<void>;
|
||||
delete(uri: Uri, options?: { recursive: boolean }): Thenable<void>;
|
||||
rename(source: Uri, target: Uri, options?: { overwrite: boolean }): Thenable<void>;
|
||||
copy(source: Uri, target: Uri, options?: { overwrite: boolean }): Thenable<void>;
|
||||
}
|
||||
|
||||
export namespace workspace {
|
||||
|
||||
export const fs: FileSystem;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user