Correctly set extensionId on comment threads

This commit is contained in:
Rachel Macfarlane
2019-06-04 11:50:36 -07:00
parent deca767716
commit 83ef31e6a2
3 changed files with 15 additions and 11 deletions

View File

@@ -299,7 +299,8 @@ export class MainThreadCommentController {
this._features = features;
}
createCommentThread(commentThreadHandle: number,
createCommentThread(extensionId: string,
commentThreadHandle: number,
threadId: string,
resource: UriComponents,
range: IRange,
@@ -307,7 +308,7 @@ export class MainThreadCommentController {
let thread = new MainThreadCommentThread(
commentThreadHandle,
this.handle,
'',
extensionId,
threadId,
URI.revive(resource).toString(),
range
@@ -552,7 +553,8 @@ export class MainThreadComments extends Disposable implements MainThreadComments
commentThreadHandle: number,
threadId: string,
resource: UriComponents,
range: IRange
range: IRange,
extensionId: ExtensionIdentifier
): modes.CommentThread2 | undefined {
let provider = this._commentControllers.get(handle);
@@ -560,7 +562,7 @@ export class MainThreadComments extends Disposable implements MainThreadComments
return undefined;
}
return provider.createCommentThread(commentThreadHandle, threadId, resource, range);
return provider.createCommentThread(extensionId.value, commentThreadHandle, threadId, resource, range);
}
$updateCommentThread(handle: number,

View File

@@ -136,7 +136,7 @@ export interface MainThreadCommentsShape extends IDisposable {
$registerCommentController(handle: number, id: string, label: string): void;
$unregisterCommentController(handle: number): void;
$updateCommentControllerFeatures(handle: number, features: CommentProviderFeatures): void;
$createCommentThread(handle: number, commentThreadHandle: number, threadId: string, resource: UriComponents, range: IRange): modes.CommentThread2 | undefined;
$createCommentThread(handle: number, commentThreadHandle: number, threadId: string, resource: UriComponents, range: IRange, extensionId: ExtensionIdentifier): modes.CommentThread2 | undefined;
$updateCommentThread(handle: number, commentThreadHandle: number, threadId: string, resource: UriComponents, range: IRange, label: string, contextValue: string | undefined, comments: modes.Comment[], acceptInputCommand: modes.Command | undefined, additionalCommands: modes.Command[], deleteCommand: modes.Command | undefined, collapseState: modes.CommentThreadCollapsibleState): void;
$deleteCommentThread(handle: number, commentThreadHandle: number): void;
$setInputValue(handle: number, input: string): void;

View File

@@ -592,7 +592,8 @@ export class ExtHostCommentThread implements vscode.CommentThread {
private _id: string | undefined,
private _uri: vscode.Uri,
private _range: vscode.Range,
private _comments: vscode.Comment[]
private _comments: vscode.Comment[],
extensionId: ExtensionIdentifier
) {
if (this._id === undefined) {
this._id = `${_commentController.id}.${this.handle}`;
@@ -603,7 +604,8 @@ export class ExtHostCommentThread implements vscode.CommentThread {
this.handle,
this._id,
this._uri,
extHostTypeConverter.Range.from(this._range)
extHostTypeConverter.Range.from(this._range),
extensionId
);
this._localDisposables = [];
@@ -751,7 +753,7 @@ class ExtHostCommentController implements vscode.CommentController {
}
constructor(
_extension: IExtensionDescription,
private _extension: IExtensionDescription,
private _handle: number,
private readonly _commandsConverter: CommandsConverter,
private _proxy: MainThreadCommentsShape,
@@ -765,18 +767,18 @@ class ExtHostCommentController implements vscode.CommentController {
createCommentThread(id: string, resource: vscode.Uri, range: vscode.Range, comments: vscode.Comment[]): vscode.CommentThread;
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._proxy, this._commandsConverter, this, arg0, arg1 as vscode.Uri, arg2 as vscode.Range, arg3 as vscode.Comment[]);
const commentThread = new ExtHostCommentThread(this._proxy, this._commandsConverter, this, 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._proxy, this._commandsConverter, this, undefined, arg0 as vscode.Uri, arg1 as vscode.Range, arg2 as vscode.Comment[]);
const commentThread = new ExtHostCommentThread(this._proxy, this._commandsConverter, this, 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) {
const commentThread = new ExtHostCommentThread(this._proxy, this._commandsConverter, this, undefined, URI.revive(uriComponents), extHostTypeConverter.Range.to(range), []);
const commentThread = new ExtHostCommentThread(this._proxy, this._commandsConverter, this, undefined, URI.revive(uriComponents), extHostTypeConverter.Range.to(range), [], this._extension.identifier);
commentThread.collapsibleState = modes.CommentThreadCollapsibleState.Expanded;
this._threads.set(commentThread.handle, commentThread);
return commentThread;