Revert "Add timestamps to comments proposal (#139849)"

This reverts commit b978d7150c.
This commit is contained in:
Alex Ross
2022-01-12 15:51:57 +01:00
parent 96b6511b5d
commit 4d1d73f6ef
17 changed files with 21 additions and 276 deletions

View File

@@ -16,9 +16,8 @@ import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensio
import { ExtHostDocuments } from 'vs/workbench/api/common/extHostDocuments';
import * as extHostTypeConverter from 'vs/workbench/api/common/extHostTypeConverters';
import * as types from 'vs/workbench/api/common/extHostTypes';
import { checkProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
import type * as vscode from 'vscode';
import { ExtHostCommentsShape, IMainContext, MainContext, CommentThreadChanges, CommentChanges } from './extHost.protocol';
import { ExtHostCommentsShape, IMainContext, MainContext, CommentThreadChanges } from './extHost.protocol';
import { ExtHostCommands } from './extHostCommands';
type ProviderHandle = number;
@@ -347,7 +346,7 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
private _uri: vscode.Uri,
private _range: vscode.Range,
private _comments: vscode.Comment[],
public readonly extensionDescription: IExtensionDescription
extensionId: ExtensionIdentifier
) {
this._acceptInputDisposables.value = new DisposableStore();
@@ -361,7 +360,7 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
this._id,
this._uri,
extHostTypeConverter.Range.from(this._range),
extensionDescription.identifier
extensionId
);
this._localDisposables = [];
@@ -434,7 +433,7 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
}
if (modified('comments')) {
formattedModifications.comments =
this._comments.map(cmt => convertToDTOComment(this, cmt, this._commentsMap));
this._comments.map(cmt => convertToModeComment(this, cmt, this._commentsMap));
}
if (modified('collapsibleState')) {
formattedModifications.collapseState = convertToCollapsibleState(this._collapseState);
@@ -562,18 +561,18 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
createCommentThread(resource: vscode.Uri, range: vscode.Range, comments: vscode.Comment[]): ExtHostCommentThread;
createCommentThread(arg0: vscode.Uri | string, arg1: vscode.Uri | vscode.Range, arg2: vscode.Range | vscode.Comment[], arg3?: vscode.Comment[]): vscode.CommentThread {
if (typeof arg0 === 'string') {
const commentThread = new ExtHostCommentThread(this.id, this.handle, arg0, arg1 as vscode.Uri, arg2 as vscode.Range, arg3 as vscode.Comment[], this._extension);
const commentThread = new ExtHostCommentThread(this.id, this.handle, arg0, arg1 as vscode.Uri, arg2 as vscode.Range, arg3 as vscode.Comment[], this._extension.identifier);
this._threads.set(commentThread.handle, commentThread);
return commentThread;
} else {
const commentThread = new ExtHostCommentThread(this.id, this.handle, undefined, arg0 as vscode.Uri, arg1 as vscode.Range, arg2 as vscode.Comment[], this._extension);
const commentThread = new ExtHostCommentThread(this.id, this.handle, undefined, arg0 as vscode.Uri, arg1 as vscode.Range, arg2 as vscode.Comment[], this._extension.identifier);
this._threads.set(commentThread.handle, commentThread);
return commentThread;
}
}
$createCommentThreadTemplate(uriComponents: UriComponents, range: IRange): ExtHostCommentThread {
const commentThread = new ExtHostCommentThread(this.id, this.handle, undefined, URI.revive(uriComponents), extHostTypeConverter.Range.to(range), [], this._extension);
const commentThread = new ExtHostCommentThread(this.id, this.handle, undefined, URI.revive(uriComponents), extHostTypeConverter.Range.to(range), [], this._extension.identifier);
commentThread.collapsibleState = modes.CommentThreadCollapsibleState.Expanded;
this._threads.set(commentThread.handle, commentThread);
return commentThread;
@@ -609,7 +608,7 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
}
}
function convertToDTOComment(thread: ExtHostCommentThread, vscodeComment: vscode.Comment, commentsMap: Map<vscode.Comment, number>): CommentChanges {
function convertToModeComment(thread: ExtHostCommentThread, vscodeComment: vscode.Comment, commentsMap: Map<vscode.Comment, number>): modes.Comment {
let commentUniqueId = commentsMap.get(vscodeComment)!;
if (!commentUniqueId) {
commentUniqueId = ++thread.commentHandle;
@@ -618,20 +617,6 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
const iconPath = vscodeComment.author && vscodeComment.author.iconPath ? vscodeComment.author.iconPath.toString() : undefined;
if (vscodeComment.detail) {
checkProposedApiEnabled(thread.extensionDescription, 'commentTimestamp');
}
let detail: { $mid: MarshalledId.Date, source: any } | string | undefined;
if (vscodeComment.detail && (typeof vscodeComment.detail !== 'string')) {
detail = {
source: vscodeComment.detail,
$mid: MarshalledId.Date
};
} else {
detail = vscodeComment.detail;
}
return {
mode: vscodeComment.mode,
contextValue: vscodeComment.contextValue,
@@ -640,8 +625,7 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
userName: vscodeComment.author.name,
userIconPath: iconPath,
label: vscodeComment.label,
commentReactions: vscodeComment.reactions ? vscodeComment.reactions.map(reaction => convertToReaction(reaction)) : undefined,
detail: detail
commentReactions: vscodeComment.reactions ? vscodeComment.reactions.map(reaction => convertToReaction(reaction)) : undefined
};
}
@@ -677,4 +661,3 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
return new ExtHostCommentsImpl();
}