Merge from vscode 473af338e1bd9ad4d9853933da1cd9d5d9e07dc9 (#5286)

This commit is contained in:
Anthony Dresser
2019-04-30 21:53:52 -07:00
committed by GitHub
parent df22eab4ec
commit 2558a66a48
29 changed files with 2259 additions and 380 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -400,7 +400,7 @@
"statusBar.noFolderBackground": "#10192c", "statusBar.noFolderBackground": "#10192c",
"statusBar.debuggingBackground": "#10192c", "statusBar.debuggingBackground": "#10192c",
// "statusBar.foreground": "", // "statusBar.foreground": "",
"statusBarItem.hostBackground": "#0063a5", "statusBarItem.remoteBackground": "#0063a5",
"statusBarItem.prominentBackground": "#0063a5", "statusBarItem.prominentBackground": "#0063a5",
"statusBarItem.prominentHoverBackground": "#0063a5dd", "statusBarItem.prominentHoverBackground": "#0063a5dd",
// "statusBarItem.activeBackground": "", // "statusBarItem.activeBackground": "",

View File

@@ -5,7 +5,7 @@
"colors": { "colors": {
"selection.background": "#008000", "selection.background": "#008000",
"editor.selectionBackground": "#FFFFFF", "editor.selectionBackground": "#FFFFFF",
"statusBarItem.hostBackground": "#00000000" "statusBarItem.remoteBackground": "#00000000"
}, },
"tokenColors": [ "tokenColors": [
{ {

View File

@@ -6,7 +6,7 @@
"editor.foreground": "#FFFFFF", "editor.foreground": "#FFFFFF",
"editorIndentGuide.background": "#FFFFFF", "editorIndentGuide.background": "#FFFFFF",
"editorIndentGuide.activeBackground": "#FFFFFF", "editorIndentGuide.activeBackground": "#FFFFFF",
"statusBarItem.hostBackground": "#00000000", "statusBarItem.remoteBackground": "#00000000",
"sideBarTitle.foreground": "#FFFFFF" "sideBarTitle.foreground": "#FFFFFF"
}, },
"settings": [ "settings": [

View File

@@ -27,7 +27,7 @@
"statusBar.background": "#423523", "statusBar.background": "#423523",
"statusBar.debuggingBackground": "#423523", "statusBar.debuggingBackground": "#423523",
"statusBar.noFolderBackground": "#423523", "statusBar.noFolderBackground": "#423523",
"statusBarItem.hostBackground": "#6e583b", "statusBarItem.remoteBackground": "#6e583b",
"activityBar.background": "#221a0f", "activityBar.background": "#221a0f",
"activityBar.foreground": "#d3af86", "activityBar.foreground": "#d3af86",
"sideBar.background": "#362712", "sideBar.background": "#362712",

View File

@@ -31,7 +31,7 @@
"statusBar.debuggingBackground": "#505050", "statusBar.debuggingBackground": "#505050",
"statusBar.noFolderBackground": "#505050", "statusBar.noFolderBackground": "#505050",
"titleBar.activeBackground": "#505050", "titleBar.activeBackground": "#505050",
"statusBarItem.hostBackground": "#3655b5", "statusBarItem.remoteBackground": "#3655b5",
"activityBar.background": "#353535", "activityBar.background": "#353535",
"activityBar.foreground": "#ffffff", "activityBar.foreground": "#ffffff",
"activityBarBadge.background": "#3655b5", "activityBarBadge.background": "#3655b5",

View File

@@ -50,7 +50,7 @@
"statusBar.background": "#414339", "statusBar.background": "#414339",
"statusBar.noFolderBackground": "#414339", "statusBar.noFolderBackground": "#414339",
"statusBar.debuggingBackground": "#75715E", "statusBar.debuggingBackground": "#75715E",
"statusBarItem.hostBackground": "#AC6218", "statusBarItem.remoteBackground": "#AC6218",
"activityBar.background": "#272822", "activityBar.background": "#272822",
"activityBar.foreground": "#f8f8f2", "activityBar.foreground": "#f8f8f2",
"activityBar.dropBackground": "#414339", "activityBar.dropBackground": "#414339",

View File

@@ -516,7 +516,7 @@
"statusBar.background": "#705697", "statusBar.background": "#705697",
"statusBar.noFolderBackground": "#705697", "statusBar.noFolderBackground": "#705697",
"statusBar.debuggingBackground": "#705697", "statusBar.debuggingBackground": "#705697",
"statusBarItem.hostBackground": "#4e3c69", "statusBarItem.remoteBackground": "#4e3c69",
"activityBar.background": "#EDEDF5", "activityBar.background": "#EDEDF5",
"activityBar.foreground": "#705697", "activityBar.foreground": "#705697",
"activityBarBadge.background": "#705697", "activityBarBadge.background": "#705697",

View File

@@ -9,7 +9,7 @@
"sideBar.background": "#330000", "sideBar.background": "#330000",
"statusBar.background": "#700000", "statusBar.background": "#700000",
"statusBar.noFolderBackground": "#700000", "statusBar.noFolderBackground": "#700000",
"statusBarItem.hostBackground": "#c33", "statusBarItem.remoteBackground": "#c33",
"editorGroupHeader.tabsBackground": "#330000", "editorGroupHeader.tabsBackground": "#330000",
"titleBar.activeBackground": "#770000", "titleBar.activeBackground": "#770000",
"titleBar.inactiveBackground": "#772222", "titleBar.inactiveBackground": "#772222",

View File

@@ -448,7 +448,7 @@
"statusBar.background": "#00212B", "statusBar.background": "#00212B",
"statusBar.debuggingBackground": "#00212B", "statusBar.debuggingBackground": "#00212B",
"statusBar.noFolderBackground": "#00212B", "statusBar.noFolderBackground": "#00212B",
"statusBarItem.hostBackground": "#2AA19899", "statusBarItem.remoteBackground": "#2AA19899",
"statusBarItem.prominentBackground": "#003847", "statusBarItem.prominentBackground": "#003847",
"statusBarItem.prominentHoverBackground": "#003847", "statusBarItem.prominentHoverBackground": "#003847",
// "statusBarItem.activeBackground": "", // "statusBarItem.activeBackground": "",

View File

@@ -447,7 +447,7 @@
"statusBar.debuggingBackground": "#EEE8D5", "statusBar.debuggingBackground": "#EEE8D5",
"statusBar.noFolderBackground": "#EEE8D5", "statusBar.noFolderBackground": "#EEE8D5",
// "statusBar.foreground": "", // "statusBar.foreground": "",
"statusBarItem.hostBackground": "#AC9D57", "statusBarItem.remoteBackground": "#AC9D57",
"statusBarItem.prominentBackground": "#DDD6C1", "statusBarItem.prominentBackground": "#DDD6C1",
"statusBarItem.prominentHoverBackground": "#DDD6C199", "statusBarItem.prominentHoverBackground": "#DDD6C199",
// "statusBarItem.activeBackground": "", // "statusBarItem.activeBackground": "",

View File

@@ -30,7 +30,7 @@
"debugToolBar.background": "#001c40", "debugToolBar.background": "#001c40",
"titleBar.activeBackground": "#001126", "titleBar.activeBackground": "#001126",
"statusBar.background": "#001126", "statusBar.background": "#001126",
"statusBarItem.hostBackground": "#0e639c", "statusBarItem.remoteBackground": "#0e639c",
"statusBar.noFolderBackground": "#001126", "statusBar.noFolderBackground": "#001126",
"statusBar.debuggingBackground": "#001126", "statusBar.debuggingBackground": "#001126",
"activityBar.background": "#001733", "activityBar.background": "#001733",

View File

@@ -25,7 +25,7 @@ if grep -qi Microsoft /proc/version; then
WIN_CODE_CMD=$(wslpath -w "$(dirname "$(realpath "$0")")/$APP_NAME.cmd") WIN_CODE_CMD=$(wslpath -w "$(dirname "$(realpath "$0")")/$APP_NAME.cmd")
# make sure the cwd is in the windows fs, otherwise there will be a warning from cmd # make sure the cwd is in the windows fs, otherwise there will be a warning from cmd
pushd "$(dirname "$0")" > /dev/null pushd "$(dirname "$0")" > /dev/null
WSL_EXT_ID="ms-vscode.remote-wsl" WSL_EXT_ID="ms-vscode-remote.remote-wsl"
WSL_EXT_WLOC=$(cmd.exe /c "$WIN_CODE_CMD" --locate-extension $WSL_EXT_ID) WSL_EXT_WLOC=$(cmd.exe /c "$WIN_CODE_CMD" --locate-extension $WSL_EXT_ID)
popd > /dev/null popd > /dev/null
if ! [ -z "$WSL_EXT_WLOC" ]; then if ! [ -z "$WSL_EXT_WLOC" ]; then

View File

@@ -17,7 +17,7 @@ set CODE=".build\electron\%NAMESHORT%"
node build\lib\electron.js node build\lib\electron.js
if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron if %errorlevel% neq 0 node .\node_modules\gulp\bin\gulp.js electron
:: Manage build-in extensions :: Manage built-in extensions
if "%1"=="--builtin" goto builtin if "%1"=="--builtin" goto builtin
:: Sync built-in extensions :: Sync built-in extensions

View File

@@ -60,7 +60,7 @@ function code-wsl()
# in a wsl shell # in a wsl shell
local WIN_CODE_CLI_CMD=$(wslpath -w "$ROOT/scripts/code-cli.bat") local WIN_CODE_CLI_CMD=$(wslpath -w "$ROOT/scripts/code-cli.bat")
if ! [ -z "$WIN_CODE_CLI_CMD" ]; then if ! [ -z "$WIN_CODE_CLI_CMD" ]; then
local WSL_EXT_ID="ms-vscode.remote-wsl" local WSL_EXT_ID="ms-vscode-remote.remote-wsl"
local WSL_EXT_WLOC=$(cmd.exe /c "$WIN_CODE_CLI_CMD" --locate-extension $WSL_EXT_ID) local WSL_EXT_WLOC=$(cmd.exe /c "$WIN_CODE_CLI_CMD" --locate-extension $WSL_EXT_ID)
if ! [ -z "$WSL_EXT_WLOC" ]; then if ! [ -z "$WSL_EXT_WLOC" ]; then
# replace \r\n with \n in WSL_EXT_WLOC # replace \r\n with \n in WSL_EXT_WLOC

View File

@@ -1215,6 +1215,7 @@ export interface Command {
* @internal * @internal
*/ */
export interface CommentThreadTemplate { export interface CommentThreadTemplate {
controllerHandle: number;
label: string; label: string;
acceptInputCommand?: Command; acceptInputCommand?: Command;
additionalCommands?: Command[]; additionalCommands?: Command[];
@@ -1281,6 +1282,7 @@ export interface CommentInput {
*/ */
export interface CommentThread2 { export interface CommentThread2 {
commentThreadHandle: number; commentThreadHandle: number;
controllerHandle: number;
extensionId?: string; extensionId?: string;
threadId: string | null; threadId: string | null;
resource: string | null; resource: string | null;

272
src/vs/vscode.d.ts vendored
View File

@@ -8940,6 +8940,278 @@ declare module 'vscode' {
*/ */
export const onDidChange: Event<void>; export const onDidChange: Event<void>;
} }
//#region Comments
/**
* Collapsible state of a [comment thread](#CommentThread)
*/
export enum CommentThreadCollapsibleState {
/**
* Determines an item is collapsed
*/
Collapsed = 0,
/**
* Determines an item is expanded
*/
Expanded = 1
}
/**
* 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 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.
*/
readonly 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;
/**
* The optional human-readable label describing the [Comment Thread](#CommentThread)
*/
label?: string;
/**
* 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[];
/**
* 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, this comment thread will be removed from visible editors and Comment Panel when approriate.
*/
dispose(): void;
}
/**
* A comment is displayed within the editor or the Comments Panel, depending on how it is provided.
*/
export class Comment {
/**
* The id of the comment
*/
readonly id: string;
/**
* The human-readable comment body
*/
readonly body: MarkdownString;
/**
* The display name of the user who created the comment
*/
readonly userName: string;
/**
* Optional label describing the [Comment](#Comment)
* Label will be rendered next to userName if exists.
*/
readonly label?: string;
/**
* The icon path for the user who created the comment
*/
readonly userIconPath?: Uri;
/**
* The command to be executed if the comment is selected in the Comments Panel
*/
readonly selectCommand?: Command;
/**
* The command to be executed when users try to save the edits to the comment
*/
readonly editCommand?: Command;
/**
* The command to be executed when users try to delete the comment
*/
readonly deleteCommand?: Command;
/**
* @param id The id of the comment
* @param body The human-readable comment body
* @param userName The display name of the user who created the comment
*/
constructor(id: string, body: MarkdownString, userName: string);
}
/**
* The comment input box in Comment Widget.
*/
export interface CommentInputBox {
/**
* Setter and getter for the contents of the comment input box
*/
value: string;
/**
* The uri of the document comment input box has been created on
*/
resource: Uri;
/**
* The range the comment input box is located within the document
*/
range: Range;
}
/**
* 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[]>;
}
/**
* Comment thread template for new comment thread creation.
*/
export interface CommentThreadTemplate {
/**
* The human-readable label describing the [Comment Thread](#CommentThread)
*/
readonly label: string;
/**
* 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.
*/
readonly acceptInputCommand?: Command;
/**
* Optional additonal commands.
*
* `additionalCommands` are the secondary actions rendered on Comment Widget.
*/
readonly 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.
*/
readonly deleteCommand?: Command;
}
/**
* 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 id of this comment controller.
*/
readonly id: string;
/**
* The human-readable label of this comment controller.
*/
readonly label: string;
/**
* 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 | undefined;
/**
* Optional comment thread template information.
*
* The comment controller will use this information to create the comment widget when users attempt to create new comment thread
* from the gutter or command palette.
*
* When users run `CommentThreadTemplate.acceptInputCommand` or `CommentThreadTemplate.additionalCommands`, extensions should create
* the approriate [CommentThread](#CommentThread).
*
* If not provided, users won't be able to create new comment threads in the editor.
*/
template?: CommentThreadTemplate;
/**
* Optional commenting range provider. Provide a list [ranges](#Range) which support commenting to any given resource uri.
*
* If not provided and `emptyCommentThreadFactory` exits, users can leave comments in any document opened in the editor.
*/
commentingRangeProvider?: CommentingRangeProvider;
/**
* 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;
/**
* 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
} }
/** /**

View File

@@ -735,91 +735,10 @@ declare module 'vscode' {
inDraftMode?: boolean; 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. * A comment is displayed within the editor or the Comments Panel, depending on how it is provided.
*/ */
export class Comment { export class CommentLegacy extends Comment {
/**
* The id of the comment
*/
readonly id: string;
/** /**
* The id of the comment * The id of the comment
* *
@@ -827,27 +746,6 @@ declare module 'vscode' {
*/ */
readonly commentId: string; readonly commentId: string;
/**
* The human-readable comment body
*/
readonly body: MarkdownString;
/**
* The display name of the user who created the comment
*/
readonly userName: string;
/**
* Optional label describing the [Comment](#Comment)
* Label will be rendered next to userName if exists.
*/
readonly label?: string;
/**
* The icon path for the user who created the comment
*/
readonly userIconPath?: Uri;
/** /**
* @deprecated Use userIconPath instead. The avatar src of the user who created the comment * @deprecated Use userIconPath instead. The avatar src of the user who created the comment
*/ */
@@ -879,21 +777,6 @@ declare module 'vscode' {
*/ */
command?: Command; command?: Command;
/**
* The command to be executed if the comment is selected in the Comments Panel
*/
readonly selectCommand?: Command;
/**
* The command to be executed when users try to save the edits to the comment
*/
readonly editCommand?: Command;
/**
* The command to be executed when users try to delete the comment
*/
readonly deleteCommand?: Command;
/** /**
* Deprecated * Deprecated
*/ */
@@ -903,13 +786,6 @@ declare module 'vscode' {
* Proposed Comment Reaction * Proposed Comment Reaction
*/ */
commentReactions?: CommentReaction[]; commentReactions?: CommentReaction[];
/**
* @param id The id of the comment
* @param body The human-readable comment body
* @param userName The display name of the user who created the comment
*/
constructor(id: string, body: MarkdownString, userName: string);
} }
/** /**
@@ -1011,16 +887,6 @@ declare module 'vscode' {
onDidChangeCommentThreads: Event<CommentThreadChangedEvent>; onDidChangeCommentThreads: Event<CommentThreadChangedEvent>;
} }
/**
* The comment input box in Comment Widget.
*/
export interface CommentInputBox {
/**
* Setter and getter for the contents of the comment input box.
*/
value: string;
}
/** /**
* Stay in proposed * Stay in proposed
*/ */
@@ -1029,118 +895,22 @@ declare module 'vscode' {
toggleReaction?(document: TextDocument, comment: Comment, reaction: CommentReaction): Promise<void>; toggleReaction?(document: TextDocument, comment: Comment, reaction: CommentReaction): Promise<void>;
} }
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 CommentThreadTemplate {
/**
* The human-readable label describing the [Comment Thread](#CommentThread)
*/
label: string;
/**
* 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[];
/**
* 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 EmptyCommentThreadFactory {
template: CommentThreadTemplate;
/**
* When users attempt to create new comment thread from the gutter or command palette, `template` will be used first to create the Comment Thread Widget in the editor for users to start comment drafting.
* Then `createEmptyCommentThread` is called after that. Extensions should still call [`createCommentThread`](CommentController.createCommentThread) to create a real [`CommentThread`](#CommentThread)
* Extensions still need to call `createCommentThread` inside this call when appropriate.
*
* @param document The document in which users attempt to create a new comment thread
* @param range The range the comment threadill located within the document.
*
* @returns commentThread The [`CommentThread`](#CommentThread) created by extensions
*/
createEmptyCommentThread(document: TextDocument, range: Range): ProviderResult<CommentThread>;
}
export interface CommentController { 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 [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 | undefined;
/**
* The active [comment thread](#CommentThread) or `undefined`. The `activeCommentThread` is the comment thread of
* the comment thread widget that currently has focus. It's `undefined` when the focus is not in any comment thread widget.
*/
readonly activeCommentThread: CommentThread | undefined;
/**
* Create a [CommentThread](#CommentThread). The comment thread will be displayed in visible text editors (if the resource matches)
* and Comments Panel.
* @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 commenting range provider. Provide a list [ranges](#Range) which support commenting to any given resource uri.
*
* If not provided and `emptyCommentThreadFactory` exits, users can leave comments in any document opened in the editor.
*/
commentingRangeProvider?: CommentingRangeProvider;
/**
* Optional empty comment thread factory. It's necessary for supporting users to trigger Comment Thread creation from the editor or command palette.
*
* If not provided, users won't be able to trigger new comment thread creation from the editor gutter area or command palette.
*/
emptyCommentThreadFactory?: EmptyCommentThreadFactory;
/** /**
* Optional reaction provider * Optional reaction provider
* Stay in proposed. * Stay in proposed.
*/ */
reactionProvider?: CommentReactionProvider; reactionProvider?: CommentReactionProvider;
/**
* Dispose this comment controller.
*/
dispose(): void;
} }
namespace comment { export interface CommentController {
export function createCommentController(id: string, label: string): CommentController; /**
* The active [comment thread](#CommentThread) or `undefined`. The `activeCommentThread` is the comment thread of
* the comment widget that currently has focus. It's `undefined` when the focus is not in any comment thread widget, or
* the comment widget created from [comment thread template](#CommentThreadTemplate).
*/
readonly activeCommentThread: CommentThread | undefined;
} }
namespace workspace { namespace workspace {

View File

@@ -192,7 +192,7 @@ export class MainThreadCommentThread implements modes.CommentThread2 {
constructor( constructor(
public commentThreadHandle: number, public commentThreadHandle: number,
public controller: MainThreadCommentController, public controllerHandle: number,
public extensionId: string, public extensionId: string,
public threadId: string, public threadId: string,
public resource: string, public resource: string,
@@ -232,7 +232,7 @@ export class MainThreadCommentThread implements modes.CommentThread2 {
toJSON(): any { toJSON(): any {
return { return {
$mid: 7, $mid: 7,
commentControlHandle: this.controller.handle, commentControlHandle: this.controllerHandle,
commentThreadHandle: this.commentThreadHandle, commentThreadHandle: this.commentThreadHandle,
}; };
} }
@@ -290,7 +290,7 @@ export class MainThreadCommentController {
): modes.CommentThread2 { ): modes.CommentThread2 {
let thread = new MainThreadCommentThread( let thread = new MainThreadCommentThread(
commentThreadHandle, commentThreadHandle,
this, this.handle,
'', '',
threadId, threadId,
URI.revive(resource).toString(), URI.revive(resource).toString(),
@@ -387,15 +387,21 @@ export class MainThreadCommentController {
resource: resource, ranges: commentingRanges, newCommentThreadCallback: async (uri: UriComponents, range: IRange) => { resource: resource, ranges: commentingRanges, newCommentThreadCallback: async (uri: UriComponents, range: IRange) => {
let threadHandle = await this._proxy.$createNewCommentWidgetCallback(this.handle, uri, range, token); let threadHandle = await this._proxy.$createNewCommentWidgetCallback(this.handle, uri, range, token);
if (threadHandle !== undefined) { // if (threadHandle !== undefined) { {{SQL CARBON EDIT}} @anthonydresser this never happens but throws error because of strict null checks
return this.getKnownThread(threadHandle); // return this.getKnownThread(threadHandle);
} // }
return undefined; // {{SQL CARBON EDIT}} @anthonydresser revert back after strict-null-check return undefined; // {{SQL CARBON EDIT}} @anthonydresser revert back after strict-null-check
} }
} : [], } : [],
draftMode: modes.DraftMode.NotSupported, draftMode: modes.DraftMode.NotSupported,
template: this._features.commentThreadTemplate template: this._features.commentThreadTemplate ? {
controllerHandle: this.handle,
label: this._features.commentThreadTemplate.label,
acceptInputCommand: this._features.commentThreadTemplate.acceptInputCommand,
additionalCommands: this._features.commentThreadTemplate.additionalCommands,
deleteCommand: this._features.commentThreadTemplate.deleteCommand
} : undefined
}; };
} }
@@ -421,6 +427,28 @@ export class MainThreadCommentController {
return ret; return ret;
} }
getCommentThreadFromTemplate(resource: UriComponents, range: IRange): MainThreadCommentThread {
let thread = new MainThreadCommentThread(
-1,
this.handle,
'',
'',
URI.revive(resource).toString(),
range
);
let template = this._features.commentThreadTemplate;
if (template) {
thread.acceptInputCommand = template.acceptInputCommand;
thread.additionalCommands = template.additionalCommands;
thread.deleteCommand = template.deleteCommand;
thread.label = template.label;
}
return thread;
}
toJSON(): any { toJSON(): any {
return { return {
$mid: 6, $mid: 6,
@@ -456,7 +484,8 @@ export class MainThreadComments extends Disposable implements MainThreadComments
this._activeCommentThreadDisposables = []; this._activeCommentThreadDisposables = [];
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostComments); this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostComments);
this._disposables.push(this._commentService.onDidChangeActiveCommentThread(async thread => { this._disposables.push(this._commentService.onDidChangeActiveCommentThread(async thread => {
let controller = (thread as MainThreadCommentThread).controller; let handle = (thread as MainThreadCommentThread).controllerHandle;
let controller = this._commentControllers.get(handle);
if (!controller) { if (!controller) {
return; return;
@@ -468,11 +497,11 @@ export class MainThreadComments extends Disposable implements MainThreadComments
this._activeCommentThreadDisposables.push(this._activeCommentThread.onDidChangeInput(input => { // todo, dispose this._activeCommentThreadDisposables.push(this._activeCommentThread.onDidChangeInput(input => { // todo, dispose
this._input = input; this._input = input;
this._proxy.$onCommentWidgetInputChange(controller.handle, this._input ? this._input.value : undefined); this._proxy.$onCommentWidgetInputChange(handle, URI.parse(this._activeCommentThread!.resource), this._activeCommentThread!.range, this._input ? this._input.value : undefined);
})); }));
await this._proxy.$onActiveCommentThreadChange(controller.handle, controller.activeCommentThread.commentThreadHandle); await this._proxy.$onActiveCommentThreadChange(controller.handle, controller.activeCommentThread.commentThreadHandle);
await this._proxy.$onCommentWidgetInputChange(controller.handle, this._input ? this._input.value : undefined); await this._proxy.$onCommentWidgetInputChange(controller.handle, URI.parse(this._activeCommentThread!.resource), this._activeCommentThread.range, this._input ? this._input.value : undefined);
})); }));
} }

View File

@@ -1213,12 +1213,12 @@ export interface ExtHostProgressShape {
export interface ExtHostCommentsShape { export interface ExtHostCommentsShape {
$provideDocumentComments(handle: number, document: UriComponents): Promise<modes.CommentInfo | null>; $provideDocumentComments(handle: number, document: UriComponents): Promise<modes.CommentInfo | null>;
$createNewCommentThread(handle: number, document: UriComponents, range: IRange, text: string): Promise<modes.CommentThread | null>; $createNewCommentThread(handle: number, document: UriComponents, range: IRange, text: string): Promise<modes.CommentThread | null>;
$onCommentWidgetInputChange(commentControllerHandle: number, input: string | undefined): Promise<number | undefined>; $onCommentWidgetInputChange(commentControllerHandle: number, document: UriComponents, range: IRange, input: string | undefined): Promise<number | undefined>;
$onActiveCommentThreadChange(commentControllerHandle: number, threadHandle: number | undefined): Promise<number | undefined>; $onActiveCommentThreadChange(commentControllerHandle: number, threadHandle: number | undefined): Promise<number | undefined>;
$provideCommentingRanges(commentControllerHandle: number, uriComponents: UriComponents, token: CancellationToken): Promise<IRange[] | undefined>; $provideCommentingRanges(commentControllerHandle: number, uriComponents: UriComponents, token: CancellationToken): Promise<IRange[] | undefined>;
$provideReactionGroup(commentControllerHandle: number): Promise<modes.CommentReaction[] | undefined>; $provideReactionGroup(commentControllerHandle: number): Promise<modes.CommentReaction[] | undefined>;
$toggleReaction(commentControllerHandle: number, threadHandle: number, uri: UriComponents, comment: modes.Comment, reaction: modes.CommentReaction): Promise<void>; $toggleReaction(commentControllerHandle: number, threadHandle: number, uri: UriComponents, comment: modes.Comment, reaction: modes.CommentReaction): Promise<void>;
$createNewCommentWidgetCallback(commentControllerHandle: number, uriComponents: UriComponents, range: IRange, token: CancellationToken): Promise<number | undefined>; $createNewCommentWidgetCallback(commentControllerHandle: number, uriComponents: UriComponents, range: IRange, token: CancellationToken): Promise<void>;
$replyToCommentThread(handle: number, document: UriComponents, range: IRange, commentThread: modes.CommentThread, text: string): Promise<modes.CommentThread | null>; $replyToCommentThread(handle: number, document: UriComponents, range: IRange, commentThread: modes.CommentThread, text: string): Promise<modes.CommentThread | null>;
$editComment(handle: number, document: UriComponents, comment: modes.Comment, text: string): Promise<void>; $editComment(handle: number, document: UriComponents, comment: modes.Comment, text: string): Promise<void>;
$deleteComment(handle: number, document: UriComponents, comment: modes.Comment): Promise<void>; $deleteComment(handle: number, document: UriComponents, comment: modes.Comment): Promise<void>;

View File

@@ -88,14 +88,14 @@ export class ExtHostComments implements ExtHostCommentsShape {
return commentController; return commentController;
} }
$onCommentWidgetInputChange(commentControllerHandle: number, input: string): Promise<number | undefined> { $onCommentWidgetInputChange(commentControllerHandle: number, uriComponents: UriComponents, range: IRange, input: string): Promise<number | undefined> {
const commentController = this._commentControllers.get(commentControllerHandle); const commentController = this._commentControllers.get(commentControllerHandle);
if (!commentController) { if (!commentController) {
return Promise.resolve(undefined); return Promise.resolve(undefined);
} }
commentController.$onCommentWidgetInputChange(input); commentController.$onCommentWidgetInputChange(uriComponents, range, input);
return Promise.resolve(commentControllerHandle); return Promise.resolve(commentControllerHandle);
} }
@@ -157,34 +157,27 @@ export class ExtHostComments implements ExtHostCommentsShape {
}); });
} }
$createNewCommentWidgetCallback(commentControllerHandle: number, uriComponents: UriComponents, range: IRange, token: CancellationToken): Promise<number | undefined> { $createNewCommentWidgetCallback(commentControllerHandle: number, uriComponents: UriComponents, range: IRange, token: CancellationToken): Promise<void> {
const commentController = this._commentControllers.get(commentControllerHandle); const commentController = this._commentControllers.get(commentControllerHandle);
if (!commentController) { if (!commentController) {
return Promise.resolve(undefined); return Promise.resolve();
} }
if (!(commentController as any).emptyCommentThreadFactory && !(commentController.commentingRangeProvider && commentController.commentingRangeProvider.createEmptyCommentThread) && !(commentController.emptyCommentThreadFactory && commentController.emptyCommentThreadFactory.createEmptyCommentThread)) { if (!(commentController as any).emptyCommentThreadFactory && !(commentController.commentingRangeProvider && commentController.commentingRangeProvider.createEmptyCommentThread)) {
return Promise.resolve(undefined); return Promise.resolve();
} }
const document = this._documents.getDocument(URI.revive(uriComponents)); const document = this._documents.getDocument(URI.revive(uriComponents));
return asPromise(() => { return asPromise(() => {
if (commentController.emptyCommentThreadFactory) { if ((commentController as any).emptyCommentThreadFactory) {
return commentController.emptyCommentThreadFactory!.createEmptyCommentThread(document, extHostTypeConverter.Range.to(range)); return (commentController as any).emptyCommentThreadFactory!.createEmptyCommentThread(document, extHostTypeConverter.Range.to(range));
} }
if (commentController.commentingRangeProvider && commentController.commentingRangeProvider.createEmptyCommentThread) { if (commentController.commentingRangeProvider && commentController.commentingRangeProvider.createEmptyCommentThread) {
return commentController.commentingRangeProvider.createEmptyCommentThread(document, extHostTypeConverter.Range.to(range)); return commentController.commentingRangeProvider.createEmptyCommentThread(document, extHostTypeConverter.Range.to(range));
} }
}).then(() => Promise.resolve());
return undefined; // {{SQL CARBON EDIT}} @anthonydresser revert back after strict-null-check
}).then((commentThread: ExtHostCommentThread | undefined) => {
if (commentThread) {
return Promise.resolve(commentThread.handle);
}
return Promise.resolve(undefined);
});
} }
registerWorkspaceCommentProvider( registerWorkspaceCommentProvider(
@@ -384,7 +377,11 @@ export class ExtHostCommentThread implements vscode.CommentThread {
private static _handlePool: number = 0; private static _handlePool: number = 0;
readonly handle = ExtHostCommentThread._handlePool++; readonly handle = ExtHostCommentThread._handlePool++;
get threadId(): string { get threadId(): string {
return this._threadId; return this._id;
}
get id(): string {
return this._id;
} }
get resource(): vscode.Uri { get resource(): vscode.Uri {
@@ -416,11 +413,11 @@ export class ExtHostCommentThread implements vscode.CommentThread {
this._onDidUpdateCommentThread.fire(); this._onDidUpdateCommentThread.fire();
} }
get comments(): vscode.Comment[] { get comments(): (vscode.Comment & vscode.CommentLegacy)[] {
return this._comments; return this._comments;
} }
set comments(newComments: vscode.Comment[]) { set comments(newComments: (vscode.Comment & vscode.CommentLegacy)[]) {
this._comments = newComments; this._comments = newComments;
this._onDidUpdateCommentThread.fire(); this._onDidUpdateCommentThread.fire();
} }
@@ -478,15 +475,15 @@ export class ExtHostCommentThread implements vscode.CommentThread {
private _proxy: MainThreadCommentsShape, private _proxy: MainThreadCommentsShape,
private readonly _commandsConverter: CommandsConverter, private readonly _commandsConverter: CommandsConverter,
private _commentController: ExtHostCommentController, private _commentController: ExtHostCommentController,
private _threadId: string, private _id: string,
private _resource: vscode.Uri, private _resource: vscode.Uri,
private _range: vscode.Range, private _range: vscode.Range,
private _comments: vscode.Comment[] private _comments: (vscode.Comment & vscode.CommentLegacy)[]
) { ) {
this._proxy.$createCommentThread( this._proxy.$createCommentThread(
this._commentController.handle, this._commentController.handle,
this.handle, this.handle,
this._threadId, this._id,
this._resource, this._resource,
extHostTypeConverter.Range.from(this._range) extHostTypeConverter.Range.from(this._range)
); );
@@ -515,7 +512,7 @@ export class ExtHostCommentThread implements vscode.CommentThread {
this._proxy.$updateCommentThread( this._proxy.$updateCommentThread(
this._commentController.handle, this._commentController.handle,
this.handle, this.handle,
this._threadId, this._id,
this._resource, this._resource,
commentThreadRange, commentThreadRange,
label, label,
@@ -549,12 +546,14 @@ export class ExtHostCommentThread implements vscode.CommentThread {
} }
export class ExtHostCommentInputBox implements vscode.CommentInputBox { export class ExtHostCommentInputBox implements vscode.CommentInputBox {
private _onDidChangeValue = new Emitter<string>(); get resource(): vscode.Uri {
return this._resource;
get onDidChangeValue(): Event<string> {
return this._onDidChangeValue.event;
} }
private _value: string = '';
get range(): vscode.Range {
return this._range;
}
get value(): string { get value(): string {
return this._value; return this._value;
} }
@@ -565,16 +564,24 @@ export class ExtHostCommentInputBox implements vscode.CommentInputBox {
this._proxy.$setInputValue(this.commentControllerHandle, newInput); this._proxy.$setInputValue(this.commentControllerHandle, newInput);
} }
constructor( private _onDidChangeValue = new Emitter<string>();
private _proxy: MainThreadCommentsShape,
public commentControllerHandle: number, get onDidChangeValue(): Event<string> {
input: string return this._onDidChangeValue.event;
) {
this._value = input;
} }
setInput(input: string) { constructor(
private _proxy: MainThreadCommentsShape,
public commentControllerHandle: number,
private _resource: vscode.Uri,
private _range: vscode.Range,
private _value: string
) {
}
setInput(resource: vscode.Uri, range: vscode.Range, input: string) {
this._resource = resource;
this._range = range;
this._value = input; this._value = input;
} }
} }
@@ -607,22 +614,22 @@ class ExtHostCommentController implements vscode.CommentController {
private _threads: Map<number, ExtHostCommentThread> = new Map<number, ExtHostCommentThread>(); private _threads: Map<number, ExtHostCommentThread> = new Map<number, ExtHostCommentThread>();
commentingRangeProvider?: vscode.CommentingRangeProvider & { createEmptyCommentThread: (document: vscode.TextDocument, range: types.Range) => Promise<vscode.CommentThread>; }; commentingRangeProvider?: vscode.CommentingRangeProvider & { createEmptyCommentThread: (document: vscode.TextDocument, range: types.Range) => Promise<vscode.CommentThread>; };
private _emptyCommentThreadFactory: vscode.EmptyCommentThreadFactory | undefined; private _template: vscode.CommentThreadTemplate | undefined;
get emptyCommentThreadFactory(): vscode.EmptyCommentThreadFactory | undefined {
return this._emptyCommentThreadFactory; get template(): vscode.CommentThreadTemplate | undefined {
return this._template;
} }
set emptyCommentThreadFactory(newEmptyCommentThreadFactory: vscode.EmptyCommentThreadFactory | undefined) { set template(newTemplate: vscode.CommentThreadTemplate | undefined) {
this._emptyCommentThreadFactory = newEmptyCommentThreadFactory; this._template = newTemplate;
if (this._emptyCommentThreadFactory && this._emptyCommentThreadFactory.template) { if (newTemplate) {
let template = this._emptyCommentThreadFactory.template; const acceptInputCommand = newTemplate.acceptInputCommand ? this._commandsConverter.toInternal(newTemplate.acceptInputCommand) : undefined;
const acceptInputCommand = template.acceptInputCommand ? this._commandsConverter.toInternal(template.acceptInputCommand) : undefined; const additionalCommands = newTemplate.additionalCommands ? newTemplate.additionalCommands.map(x => this._commandsConverter.toInternal(x)) : [];
const additionalCommands = template.additionalCommands ? template.additionalCommands.map(x => this._commandsConverter.toInternal(x)) : []; const deleteCommand = newTemplate.deleteCommand ? this._commandsConverter.toInternal(newTemplate.deleteCommand) : undefined;
const deleteCommand = template.deleteCommand ? this._commandsConverter.toInternal(template.deleteCommand) : undefined;
this._proxy.$updateCommentControllerFeatures(this.handle, { this._proxy.$updateCommentControllerFeatures(this.handle, {
commentThreadTemplate: { commentThreadTemplate: {
label: template.label, label: newTemplate.label,
acceptInputCommand, acceptInputCommand,
additionalCommands, additionalCommands,
deleteCommand deleteCommand
@@ -655,17 +662,17 @@ class ExtHostCommentController implements vscode.CommentController {
this._proxy.$registerCommentController(this.handle, _id, _label); this._proxy.$registerCommentController(this.handle, _id, _label);
} }
createCommentThread(id: string, resource: vscode.Uri, range: vscode.Range, comments: vscode.Comment[]): vscode.CommentThread { createCommentThread(id: string, resource: vscode.Uri, range: vscode.Range, comments: (vscode.Comment & vscode.CommentLegacy)[]): vscode.CommentThread {
const commentThread = new ExtHostCommentThread(this._proxy, this._commandsConverter, this, id, resource, range, comments); const commentThread = new ExtHostCommentThread(this._proxy, this._commandsConverter, this, id, resource, range, comments);
this._threads.set(commentThread.handle, commentThread); this._threads.set(commentThread.handle, commentThread);
return commentThread; return commentThread;
} }
$onCommentWidgetInputChange(input: string) { $onCommentWidgetInputChange(uriComponents: UriComponents, range: IRange, input: string) {
if (!this.inputBox) { if (!this.inputBox) {
this.inputBox = new ExtHostCommentInputBox(this._proxy, this.handle, input); this.inputBox = new ExtHostCommentInputBox(this._proxy, this.handle, URI.revive(uriComponents), extHostTypeConverter.Range.to(range), input);
} else { } else {
this.inputBox.setInput(input); this.inputBox.setInput(URI.revive(uriComponents), extHostTypeConverter.Range.to(range), input);
} }
} }
@@ -698,25 +705,27 @@ function convertCommentInfo(owner: number, extensionId: ExtensionIdentifier, pro
function convertToCommentThread(extensionId: ExtensionIdentifier, provider: vscode.DocumentCommentProvider | vscode.WorkspaceCommentProvider, vscodeCommentThread: vscode.CommentThread, commandsConverter: CommandsConverter): modes.CommentThread { function convertToCommentThread(extensionId: ExtensionIdentifier, provider: vscode.DocumentCommentProvider | vscode.WorkspaceCommentProvider, vscodeCommentThread: vscode.CommentThread, commandsConverter: CommandsConverter): modes.CommentThread {
return { return {
extensionId: extensionId.value, extensionId: extensionId.value,
threadId: vscodeCommentThread.threadId, threadId: vscodeCommentThread.id,
resource: vscodeCommentThread.resource.toString(), resource: vscodeCommentThread.resource.toString(),
range: extHostTypeConverter.Range.from(vscodeCommentThread.range), range: extHostTypeConverter.Range.from(vscodeCommentThread.range),
comments: vscodeCommentThread.comments.map(comment => convertToComment(provider, comment, commandsConverter)), comments: vscodeCommentThread.comments.map(comment => convertToComment(provider, comment as vscode.Comment & vscode.CommentLegacy, commandsConverter)),
collapsibleState: vscodeCommentThread.collapsibleState collapsibleState: vscodeCommentThread.collapsibleState
}; };
} }
function convertFromCommentThread(commentThread: modes.CommentThread): vscode.CommentThread { function convertFromCommentThread(commentThread: modes.CommentThread): vscode.CommentThread {
return { return {
id: commentThread.threadId!,
threadId: commentThread.threadId!, threadId: commentThread.threadId!,
resource: URI.parse(commentThread.resource!), resource: URI.parse(commentThread.resource!),
range: extHostTypeConverter.Range.to(commentThread.range), range: extHostTypeConverter.Range.to(commentThread.range),
comments: commentThread.comments ? commentThread.comments.map(convertFromComment) : [], comments: commentThread.comments ? commentThread.comments.map(convertFromComment) : [],
collapsibleState: commentThread.collapsibleState collapsibleState: commentThread.collapsibleState,
}; dispose: () => { }
} as vscode.CommentThread;
} }
function convertFromComment(comment: modes.Comment): vscode.Comment { function convertFromComment(comment: modes.Comment): vscode.Comment & vscode.CommentLegacy {
let userIconPath: URI | undefined; let userIconPath: URI | undefined;
if (comment.userIconPath) { if (comment.userIconPath) {
try { try {
@@ -745,7 +754,7 @@ function convertFromComment(comment: modes.Comment): vscode.Comment {
}; };
} }
function convertToModeComment(commentController: ExtHostCommentController, vscodeComment: vscode.Comment, commandsConverter: CommandsConverter): modes.Comment { function convertToModeComment(commentController: ExtHostCommentController, vscodeComment: vscode.Comment & vscode.CommentLegacy, commandsConverter: CommandsConverter): modes.Comment {
const iconPath = vscodeComment.userIconPath ? vscodeComment.userIconPath.toString() : vscodeComment.gravatar; const iconPath = vscodeComment.userIconPath ? vscodeComment.userIconPath.toString() : vscodeComment.gravatar;
return { return {
@@ -762,7 +771,7 @@ function convertToModeComment(commentController: ExtHostCommentController, vscod
}; };
} }
function convertToComment(provider: vscode.DocumentCommentProvider | vscode.WorkspaceCommentProvider, vscodeComment: vscode.Comment, commandsConverter: CommandsConverter): modes.Comment { function convertToComment(provider: vscode.DocumentCommentProvider | vscode.WorkspaceCommentProvider, vscodeComment: vscode.Comment & vscode.CommentLegacy, commandsConverter: CommandsConverter): modes.Comment {
const canEdit = !!(provider as vscode.DocumentCommentProvider).editComment && vscodeComment.canEdit; const canEdit = !!(provider as vscode.DocumentCommentProvider).editComment && vscodeComment.canEdit;
const canDelete = !!(provider as vscode.DocumentCommentProvider).deleteComment && vscodeComment.canDelete; const canDelete = !!(provider as vscode.DocumentCommentProvider).deleteComment && vscodeComment.canDelete;
const iconPath = vscodeComment.userIconPath ? vscodeComment.userIconPath.toString() : vscodeComment.gravatar; const iconPath = vscodeComment.userIconPath ? vscodeComment.userIconPath.toString() : vscodeComment.gravatar;

View File

@@ -781,6 +781,7 @@ export function createApiFactory(
ColorInformation: extHostTypes.ColorInformation, ColorInformation: extHostTypes.ColorInformation,
ColorPresentation: extHostTypes.ColorPresentation, ColorPresentation: extHostTypes.ColorPresentation,
Comment: extHostTypes.Comment, Comment: extHostTypes.Comment,
CommentLegacy: extHostTypes.Comment,
CommentThreadCollapsibleState: extHostTypes.CommentThreadCollapsibleState, CommentThreadCollapsibleState: extHostTypes.CommentThreadCollapsibleState,
CompletionItem: extHostTypes.CompletionItem, CompletionItem: extHostTypes.CompletionItem,
CompletionItemKind: extHostTypes.CompletionItemKind, CompletionItemKind: extHostTypes.CompletionItemKind,

View File

@@ -66,6 +66,7 @@ export interface ICommentService {
deleteReaction(owner: string, resource: URI, comment: Comment, reaction: CommentReaction): Promise<void>; deleteReaction(owner: string, resource: URI, comment: Comment, reaction: CommentReaction): Promise<void>;
getReactionGroup(owner: string): CommentReaction[] | undefined; getReactionGroup(owner: string): CommentReaction[] | undefined;
toggleReaction(owner: string, resource: URI, thread: CommentThread2, comment: Comment, reaction: CommentReaction): Promise<void>; toggleReaction(owner: string, resource: URI, thread: CommentThread2, comment: Comment, reaction: CommentReaction): Promise<void>;
getCommentThreadFromTemplate(owner: string, resource: URI, range: IRange, ): CommentThread2 | undefined;
setActiveCommentThread(commentThread: CommentThread | null): void; setActiveCommentThread(commentThread: CommentThread | null): void;
setInput(input: string): void; setInput(input: string): void;
} }
@@ -255,6 +256,16 @@ export class CommentService extends Disposable implements ICommentService {
} }
} }
getCommentThreadFromTemplate(owner: string, resource: URI, range: IRange, ): CommentThread2 | undefined {
const commentController = this._commentControls.get(owner);
if (commentController) {
return commentController.getCommentThreadFromTemplate(resource, range);
}
return undefined;
}
getReactionGroup(owner: string): CommentReaction[] | undefined { getReactionGroup(owner: string): CommentReaction[] | undefined {
const commentProvider = this._commentControls.get(owner); const commentProvider = this._commentControls.get(owner);

View File

@@ -65,6 +65,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
private _commentGlyph?: CommentGlyphWidget; private _commentGlyph?: CommentGlyphWidget;
private _submitActionsDisposables: IDisposable[]; private _submitActionsDisposables: IDisposable[];
private _globalToDispose: IDisposable[]; private _globalToDispose: IDisposable[];
private _commentThreadDisposables: IDisposable[] = [];
private _markdownRenderer: MarkdownRenderer; private _markdownRenderer: MarkdownRenderer;
private _styleElement: HTMLStyleElement; private _styleElement: HTMLStyleElement;
private _formActions: HTMLElement | null; private _formActions: HTMLElement | null;
@@ -103,6 +104,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
this._resizeObserver = null; this._resizeObserver = null;
this._isExpanded = _commentThread.collapsibleState ? _commentThread.collapsibleState === modes.CommentThreadCollapsibleState.Expanded : undefined; this._isExpanded = _commentThread.collapsibleState ? _commentThread.collapsibleState === modes.CommentThreadCollapsibleState.Expanded : undefined;
this._globalToDispose = []; this._globalToDispose = [];
this._commentThreadDisposables = [];
this._submitActionsDisposables = []; this._submitActionsDisposables = [];
this._formActions = null; this._formActions = null;
this.create(); this.create();
@@ -214,6 +216,9 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
if (deleteCommand) { if (deleteCommand) {
this.commentService.setActiveCommentThread(this._commentThread); this.commentService.setActiveCommentThread(this._commentThread);
return this.commandService.executeCommand(deleteCommand.id, ...(deleteCommand.arguments || [])); return this.commandService.executeCommand(deleteCommand.id, ...(deleteCommand.arguments || []));
} else if (this._commentEditor.getValue() === '') {
this.dispose();
return Promise.resolve();
} }
} }
} }
@@ -291,6 +296,12 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
this._commentElements = newCommentNodeList; this._commentElements = newCommentNodeList;
this.createThreadLabel(replaceTemplate); this.createThreadLabel(replaceTemplate);
if (replaceTemplate) {
// since we are replacing the old comment thread, we need to rebind the listeners.
this._commentThreadDisposables.forEach(global => global.dispose());
this._commentThreadDisposables = [];
}
if (replaceTemplate) { if (replaceTemplate) {
this.createTextModelListener(); this.createTextModelListener();
} }
@@ -395,7 +406,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
this._commentEditor.setModel(model); this._commentEditor.setModel(model);
this._disposables.push(this._commentEditor); this._disposables.push(this._commentEditor);
this._disposables.push(this._commentEditor.getModel()!.onDidChangeContent(() => this.setCommentEditorDecorations())); this._disposables.push(this._commentEditor.getModel()!.onDidChangeContent(() => this.setCommentEditorDecorations()));
if ((this._commentThread as modes.CommentThread2).commentThreadHandle !== undefined && !fromTemplate) { if ((this._commentThread as modes.CommentThread2).commentThreadHandle !== undefined) {
this.createTextModelListener(); this.createTextModelListener();
} }
@@ -445,7 +456,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
} }
private createTextModelListener() { private createTextModelListener() {
this._disposables.push(this._commentEditor.onDidFocusEditorWidget(() => { this._commentThreadDisposables.push(this._commentEditor.onDidFocusEditorWidget(() => {
let commentThread = this._commentThread as modes.CommentThread2; let commentThread = this._commentThread as modes.CommentThread2;
commentThread.input = { commentThread.input = {
uri: this._commentEditor.getModel()!.uri, uri: this._commentEditor.getModel()!.uri,
@@ -454,7 +465,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
this.commentService.setActiveCommentThread(this._commentThread); this.commentService.setActiveCommentThread(this._commentThread);
})); }));
this._disposables.push(this._commentEditor.getModel()!.onDidChangeContent(() => { this._commentThreadDisposables.push(this._commentEditor.getModel()!.onDidChangeContent(() => {
let modelContent = this._commentEditor.getValue(); let modelContent = this._commentEditor.getValue();
let thread = (this._commentThread as modes.CommentThread2); let thread = (this._commentThread as modes.CommentThread2);
if (thread.input && thread.input.uri === this._commentEditor.getModel()!.uri && thread.input.value !== modelContent) { if (thread.input && thread.input.uri === this._commentEditor.getModel()!.uri && thread.input.value !== modelContent) {
@@ -464,7 +475,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
} }
})); }));
this._disposables.push((this._commentThread as modes.CommentThread2).onDidChangeInput(input => { this._commentThreadDisposables.push((this._commentThread as modes.CommentThread2).onDidChangeInput(input => {
let thread = (this._commentThread as modes.CommentThread2); let thread = (this._commentThread as modes.CommentThread2);
if (thread.input && thread.input.uri !== this._commentEditor.getModel()!.uri) { if (thread.input && thread.input.uri !== this._commentEditor.getModel()!.uri) {
@@ -489,31 +500,31 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
} }
})); }));
this._disposables.push((this._commentThread as modes.CommentThread2).onDidChangeComments(async _ => { this._commentThreadDisposables.push((this._commentThread as modes.CommentThread2).onDidChangeComments(async _ => {
await this.update(this._commentThread); await this.update(this._commentThread);
})); }));
this._disposables.push((this._commentThread as modes.CommentThread2).onDidChangeLabel(_ => { this._commentThreadDisposables.push((this._commentThread as modes.CommentThread2).onDidChangeLabel(_ => {
this.createThreadLabel(); this.createThreadLabel();
})); }));
} }
private createCommentWidgetActionsListener(container: HTMLElement, model: ITextModel) { private createCommentWidgetActionsListener(container: HTMLElement, model: ITextModel) {
this._disposables.push((this._commentThread as modes.CommentThread2).onDidChangeAcceptInputCommand(_ => { this._commentThreadDisposables.push((this._commentThread as modes.CommentThread2).onDidChangeAcceptInputCommand(_ => {
if (container) { if (container) {
dom.clearNode(container); dom.clearNode(container);
this.createCommentWidgetActions2(container, model); this.createCommentWidgetActions2(container, model);
} }
})); }));
this._disposables.push((this._commentThread as modes.CommentThread2).onDidChangeAdditionalCommands(_ => { this._commentThreadDisposables.push((this._commentThread as modes.CommentThread2).onDidChangeAdditionalCommands(_ => {
if (container) { if (container) {
dom.clearNode(container); dom.clearNode(container);
this.createCommentWidgetActions2(container, model); this.createCommentWidgetActions2(container, model);
} }
})); }));
this._disposables.push((this._commentThread as modes.CommentThread2).onDidChangeRange(range => { this._commentThreadDisposables.push((this._commentThread as modes.CommentThread2).onDidChangeRange(range => {
// Move comment glyph widget and show position if the line has changed. // Move comment glyph widget and show position if the line has changed.
const lineNumber = this._commentThread.range.startLineNumber; const lineNumber = this._commentThread.range.startLineNumber;
let shouldMoveWidget = false; let shouldMoveWidget = false;
@@ -529,7 +540,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
} }
})); }));
this._disposables.push((this._commentThread as modes.CommentThread2).onDidChangeCollasibleState(state => { this._commentThreadDisposables.push((this._commentThread as modes.CommentThread2).onDidChangeCollasibleState(state => {
if (state === modes.CommentThreadCollapsibleState.Expanded && !this._isExpanded) { if (state === modes.CommentThreadCollapsibleState.Expanded && !this._isExpanded) {
const lineNumber = this._commentThread.range.startLineNumber; const lineNumber = this._commentThread.range.startLineNumber;
@@ -1062,6 +1073,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
} }
this._globalToDispose.forEach(global => global.dispose()); this._globalToDispose.forEach(global => global.dispose());
this._commentThreadDisposables.forEach(global => global.dispose());
this._submitActionsDisposables.forEach(local => local.dispose()); this._submitActionsDisposables.forEach(local => local.dispose());
this._onDidClose.fire(undefined); this._onDidClose.fire(undefined);
} }

View File

@@ -446,6 +446,13 @@ export class ReviewController implements IEditorContribution {
return; return;
} }
let matchedNewCommentThreadZones = this._commentWidgets.filter(zoneWidget => zoneWidget.owner === e.owner && (zoneWidget.commentThread as any).commentThreadHandle === -1 && Range.equalsRange(zoneWidget.commentThread.range, thread.range));
if (matchedNewCommentThreadZones.length) {
matchedNewCommentThreadZones[0].update(thread, true);
return;
}
const pendingCommentText = this._pendingCommentCache[e.owner] && this._pendingCommentCache[e.owner][thread.threadId]; const pendingCommentText = this._pendingCommentCache[e.owner] && this._pendingCommentCache[e.owner][thread.threadId];
this.displayCommentThread(e.owner, thread, pendingCommentText, draftMode); this.displayCommentThread(e.owner, thread, pendingCommentText, draftMode);
this._commentInfos.filter(info => info.owner === e.owner)[0].threads.push(thread); this._commentInfos.filter(info => info.owner === e.owner)[0].threads.push(thread);
@@ -462,26 +469,18 @@ export class ReviewController implements IEditorContribution {
this._commentWidgets.push(zoneWidget); this._commentWidgets.push(zoneWidget);
} }
private addCommentThreadFromTemplate(lineNumber: number, ownerId: string, extensionId: string | undefined, template: modes.CommentThreadTemplate): ReviewZoneWidget { private addCommentThreadFromTemplate(lineNumber: number, ownerId: string): ReviewZoneWidget {
let templateReviewZoneWidget = this.instantiationService.createInstance(ReviewZoneWidget, this.editor, ownerId, { let templateCommentThread = this.commentService.getCommentThreadFromTemplate(ownerId, this.editor.getModel()!.uri, {
commentThreadHandle: -1, startLineNumber: lineNumber,
label: template!.label, startColumn: 1,
acceptInputCommand: template.acceptInputCommand, endLineNumber: lineNumber,
additionalCommands: template.additionalCommands, endColumn: 1
deleteCommand: template.deleteCommand, })!;
extensionId: extensionId,
threadId: null, templateCommentThread.collapsibleState = modes.CommentThreadCollapsibleState.Expanded;
resource: null, templateCommentThread.comments = [];
comments: [],
range: { let templateReviewZoneWidget = this.instantiationService.createInstance(ReviewZoneWidget, this.editor, ownerId, templateCommentThread, '', modes.DraftMode.NotSupported);
startLineNumber: lineNumber,
startColumn: 0,
endLineNumber: lineNumber,
endColumn: 0
},
collapsibleState: modes.CommentThreadCollapsibleState.Expanded,
},
'', modes.DraftMode.NotSupported);
return templateReviewZoneWidget; return templateReviewZoneWidget;
} }
@@ -692,22 +691,19 @@ export class ReviewController implements IEditorContribution {
public addCommentAtLine2(lineNumber: number, replyCommand: modes.Command | undefined, ownerId: string, extensionId: string | undefined, commentingRangesInfo: modes.CommentingRanges | undefined, template: modes.CommentThreadTemplate | undefined) { public addCommentAtLine2(lineNumber: number, replyCommand: modes.Command | undefined, ownerId: string, extensionId: string | undefined, commentingRangesInfo: modes.CommentingRanges | undefined, template: modes.CommentThreadTemplate | undefined) {
if (commentingRangesInfo) { if (commentingRangesInfo) {
let range = new Range(lineNumber, 1, lineNumber, 1); let range = new Range(lineNumber, 1, lineNumber, 1);
if (commentingRangesInfo.newCommentThreadCallback && template) { if (template) {
// create comment widget through template // create comment widget through template
let commentThreadWidget = this.addCommentThreadFromTemplate(lineNumber, ownerId, extensionId, template); let commentThreadWidget = this.addCommentThreadFromTemplate(lineNumber, ownerId);
commentThreadWidget.display(lineNumber, true); commentThreadWidget.display(lineNumber, true);
this._commentWidgets.push(commentThreadWidget);
return commentingRangesInfo.newCommentThreadCallback(this.editor.getModel()!.uri, range) commentThreadWidget.onDidClose(() => {
.then(commentThread => { this._commentWidgets = this._commentWidgets.filter(zoneWidget => !(
commentThreadWidget.update(commentThread!, true); zoneWidget.owner === commentThreadWidget.owner &&
this._commentWidgets.push(commentThreadWidget); (zoneWidget.commentThread as any).commentThreadHandle === -1 &&
this.processNextThreadToAdd(); Range.equalsRange(zoneWidget.commentThread.range, commentThreadWidget.commentThread.range)
}) ));
.catch(e => { });
this.notificationService.error(nls.localize('commentThreadAddFailure', "Adding a new comment thread failed: {0}.", e.message)); this.processNextThreadToAdd();
commentThreadWidget.dispose();
this.processNextThreadToAdd();
});
} else if (commentingRangesInfo.newCommentThreadCallback) { } else if (commentingRangesInfo.newCommentThreadCallback) {
return commentingRangesInfo.newCommentThreadCallback(this.editor.getModel()!.uri, range) return commentingRangesInfo.newCommentThreadCallback(this.editor.getModel()!.uri, range)
.then(_ => { .then(_ => {

View File

@@ -168,7 +168,7 @@ export class TooltipWidget extends ExtensionWidget {
this.parent.removeAttribute('aria-label'); this.parent.removeAttribute('aria-label');
this.parent.title = this.getTooltip(); this.parent.title = this.getTooltip();
if (this.extension) { if (this.extension) {
this.parent.setAttribute('aria-label', localize('extension-arialabel', "{0}. {1} Press enter for extension details.", this.extension.displayName)); this.parent.setAttribute('aria-label', localize('extension-arialabel', "{0}. Press enter for extension details.", this.extension.displayName));
} }
} }

View File

@@ -15,10 +15,9 @@ export function setup() {
return; return;
} }
const extensionName = 'vscode-smoketest-check';
await app.workbench.extensions.openExtensionsViewlet(); await app.workbench.extensions.openExtensionsViewlet();
await app.workbench.extensions.installExtension(extensionName); await app.workbench.extensions.installExtension('michelkaporin.vscode-smoketest-check', 'vscode-smoketest-check');
await app.workbench.extensions.waitForExtensionsViewlet(); await app.workbench.extensions.waitForExtensionsViewlet();
await app.workbench.quickopen.runCommand('Smoke Test Check'); await app.workbench.quickopen.runCommand('Smoke Test Check');

View File

@@ -28,14 +28,14 @@ export class Extensions extends Viewlet {
await this.code.waitForElement(SEARCH_BOX); await this.code.waitForElement(SEARCH_BOX);
} }
async searchForExtension(name: string): Promise<any> { async searchForExtension(id: string): Promise<any> {
await this.code.waitAndClick(SEARCH_BOX); await this.code.waitAndClick(SEARCH_BOX);
await this.code.waitForActiveElement(SEARCH_BOX); await this.code.waitForActiveElement(SEARCH_BOX);
await this.code.waitForTypeInEditor(SEARCH_BOX, `name:"${name}"`); await this.code.waitForTypeInEditor(SEARCH_BOX, `@id:${id}`);
} }
async installExtension(name: string): Promise<void> { async installExtension(id: string, name: string): Promise<void> {
await this.searchForExtension(name); await this.searchForExtension(id);
const ariaLabel = `${name}. Press enter for extension details.`; const ariaLabel = `${name}. Press enter for extension details.`;
await this.code.waitAndClick(`div.extensions-viewlet[id="workbench.view.extensions"] .monaco-list-row[aria-label="${ariaLabel}"] .extension li[class='action-item'] .extension-action.install`); await this.code.waitAndClick(`div.extensions-viewlet[id="workbench.view.extensions"] .monaco-list-row[aria-label="${ariaLabel}"] .extension li[class='action-item'] .extension-action.install`);
await this.code.waitForElement(`.extension-editor .monaco-action-bar .action-item:not(.disabled) .extension-action.uninstall`); await this.code.waitForElement(`.extension-editor .monaco-action-bar .action-item:not(.disabled) .extension-action.uninstall`);

View File

@@ -14,9 +14,8 @@ export function setup() {
return; return;
} }
const extensionName = 'German Language Pack for Visual Studio Code';
await app.workbench.extensions.openExtensionsViewlet(); await app.workbench.extensions.openExtensionsViewlet();
await app.workbench.extensions.installExtension(extensionName); await app.workbench.extensions.installExtension('ms-ceintl.vscode-language-pack-de', 'German Language Pack for Visual Studio Code');
await app.restart({ extraArgs: ['--locale=DE'] }); await app.restart({ extraArgs: ['--locale=DE'] });
}); });