From bb353b47fb1dae344d937ba606bdf6d234f886cc Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 28 May 2019 12:14:24 +0200 Subject: [PATCH 01/10] Use file service to update content --- .../configurationService.test.ts | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts index 1ab75f0c751..a02336efbe5 100644 --- a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts +++ b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts @@ -44,6 +44,7 @@ import { ConfigurationCache } from 'vs/workbench/services/configuration/node/con import { ConfigurationFileService } from 'vs/workbench/services/configuration/node/configurationFileService'; import { IRemoteAgentEnvironment } from 'vs/platform/remote/common/remoteAgentEnvironment'; import { IConfigurationCache } from 'vs/workbench/services/configuration/common/configuration'; +import { VSBuffer } from 'vs/base/common/buffer'; class SettingsTestEnvironmentService extends EnvironmentService { @@ -1574,26 +1575,26 @@ suite('WorkspaceConfigurationService - Remote Folder', () => { return promise; }); - // test('update remote settings', async () => { - // registerRemoteFileSystemProvider(); - // resolveRemoteEnvironment(); - // await initialize(); - // assert.equal(testObject.getValue('configurationService.remote.machineSetting'), 'isSet'); - // const promise = new Promise((c, e) => { - // testObject.onDidChangeConfiguration(event => { - // try { - // assert.equal(event.source, ConfigurationTarget.USER); - // assert.deepEqual(event.affectedKeys, ['configurationService.remote.machineSetting']); - // assert.equal(testObject.getValue('configurationService.remote.machineSetting'), 'remoteValue'); - // c(); - // } catch (error) { - // e(error); - // } - // }); - // }); - // fs.writeFileSync(remoteSettingsFile, '{ "configurationService.remote.machineSetting": "remoteValue" }'); - // return promise; - // }); + test('update remote settings', async () => { + registerRemoteFileSystemProvider(); + resolveRemoteEnvironment(); + await initialize(); + assert.equal(testObject.getValue('configurationService.remote.machineSetting'), 'isSet'); + const promise = new Promise((c, e) => { + testObject.onDidChangeConfiguration(event => { + try { + assert.equal(event.source, ConfigurationTarget.USER); + assert.deepEqual(event.affectedKeys, ['configurationService.remote.machineSetting']); + assert.equal(testObject.getValue('configurationService.remote.machineSetting'), 'remoteValue'); + c(); + } catch (error) { + e(error); + } + }); + }); + await instantiationService.get(IFileService).writeFile(URI.file(remoteSettingsFile), VSBuffer.fromString('{ "configurationService.remote.machineSetting": "remoteValue" }')); + return promise; + }); test('machine settings in local user settings does not override defaults', async () => { fs.writeFileSync(globalSettingsFile, '{ "configurationService.remote.machineSetting": "globalValue" }'); From 2d0e087ecb977b1a58dfc3999eb2c1c9dc0c6a21 Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Thu, 30 May 2019 16:19:28 -0700 Subject: [PATCH 02/10] oss 1.35 --- ThirdPartyNotices.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThirdPartyNotices.txt b/ThirdPartyNotices.txt index 7520dee2091..df0fad7f826 100644 --- a/ThirdPartyNotices.txt +++ b/ThirdPartyNotices.txt @@ -65,7 +65,7 @@ This project incorporates components from the projects listed below. The origina 58. TypeScript-TmLanguage version 1.0.0 (https://github.com/Microsoft/TypeScript-TmLanguage) 59. Unicode version 12.0.0 (http://www.unicode.org/) 60. vscode-logfile-highlighter version 2.4.1 (https://github.com/emilast/vscode-logfile-highlighter) -61. vscode-octicons-font version 1.2.0 (https://github.com/Microsoft/vscode-octicons-font) +61. vscode-octicons-font version 1.3.0 (https://github.com/Microsoft/vscode-octicons-font) 62. vscode-swift version 0.0.1 (https://github.com/owensd/vscode-swift) 63. Web Background Synchronization (https://github.com/WICG/BackgroundSync) From 96a0265a855992feaf0bdd2bdeb97c5ac7802ea3 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 31 May 2019 09:30:15 +0200 Subject: [PATCH 03/10] fix #74566 --- src/vs/editor/common/config/commonEditorConfig.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index 7571c594af6..3752591e93f 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -839,7 +839,7 @@ const editorConfiguration: IConfigurationNode = { enumDescriptions: [ nls.localize('editor.gotoLocation.multiple.peek', 'Show peek view of the results (default)'), nls.localize('editor.gotoLocation.multiple.gotoAndPeek', 'Go to the primary result and show a peek view'), - nls.localize('editor.gotoLocation.multiple.goto', 'Go to the primary result and ignore others') + nls.localize('editor.gotoLocation.multiple.goto', 'Go to the primary result and enable peek-less navigation to others') ] }, 'editor.selectionHighlight': { From 59794815ce4f4b5206257175f06273ab505c650f Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 31 May 2019 12:39:40 +0200 Subject: [PATCH 04/10] when adding contributed keybindings check if a command with enablement-clause exists --- .../workbench/api/common/menusExtensionPoint.ts | 6 ++++-- .../electron-browser/keybindingService.ts | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/api/common/menusExtensionPoint.ts b/src/vs/workbench/api/common/menusExtensionPoint.ts index 6bbbaa5022d..65395d5ed4c 100644 --- a/src/vs/workbench/api/common/menusExtensionPoint.ts +++ b/src/vs/workbench/api/common/menusExtensionPoint.ts @@ -331,10 +331,12 @@ namespace schema { let _commandRegistrations: IDisposable[] = []; -ExtensionsRegistry.registerExtensionPoint({ +export const commandsExtensionPoint = ExtensionsRegistry.registerExtensionPoint({ extensionPoint: 'commands', jsonSchema: schema.commandsContribution -}).setHandler(extensions => { +}); + +commandsExtensionPoint.setHandler(extensions => { function handleCommand(userFriendlyCommand: schema.IUserFriendlyCommand, extension: IExtensionPointUser, disposables: IDisposable[]) { diff --git a/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts b/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts index 85e921e9229..2207d362f16 100644 --- a/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts +++ b/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts @@ -41,6 +41,7 @@ import { IWindowService } from 'vs/platform/windows/common/windows'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { MenuRegistry } from 'vs/platform/actions/common/actions'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; +import { commandsExtensionPoint } from 'vs/workbench/api/common/menusExtensionPoint'; export class KeyboardMapperFactory { public static readonly INSTANCE = new KeyboardMapperFactory(); @@ -239,6 +240,7 @@ let keybindingType: IJSONSchema = { const keybindingsExtPoint = ExtensionsRegistry.registerExtensionPoint({ extensionPoint: 'keybindings', + deps: [commandsExtensionPoint], jsonSchema: { description: nls.localize('vscode.extension.contributes.keybindings', "Contributes keybindings."), oneOf: [ @@ -500,10 +502,21 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService { weight = KeybindingWeight.ExternalExtension + idx; } + let commandAction = MenuRegistry.getCommand(command); + let precondition = commandAction && commandAction.precondition; + let fullWhen: ContextKeyExpr | undefined; + if (when && precondition) { + fullWhen = ContextKeyExpr.and(precondition, ContextKeyExpr.deserialize(when)); + } else if (when) { + fullWhen = ContextKeyExpr.deserialize(when); + } else if (precondition) { + fullWhen = precondition; + } + let desc: IKeybindingRule2 = { id: command, args, - when: ContextKeyExpr.deserialize(when), + when: fullWhen, weight: weight, primary: KeybindingParser.parseKeybinding(key, OS), mac: mac ? { primary: KeybindingParser.parseKeybinding(mac, OS) } : null, @@ -712,4 +725,4 @@ const keyboardConfiguration: IConfigurationNode = { configurationRegistry.registerConfiguration(keyboardConfiguration); -registerSingleton(IKeybindingService, WorkbenchKeybindingService); \ No newline at end of file +registerSingleton(IKeybindingService, WorkbenchKeybindingService); From 827bd5f735ac9f3dfdba763796f025d337fff3b3 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 31 May 2019 13:11:21 +0200 Subject: [PATCH 05/10] fix #74548 --- .../browser/parts/editor/editorGroupView.ts | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/editorGroupView.ts b/src/vs/workbench/browser/parts/editor/editorGroupView.ts index 65615a7e2d4..c8c88be592d 100644 --- a/src/vs/workbench/browser/parts/editor/editorGroupView.ts +++ b/src/vs/workbench/browser/parts/editor/editorGroupView.ts @@ -833,33 +833,34 @@ export class EditorGroupView extends Themable implements IEditorGroupView { private async doShowEditor(editor: EditorInput, active: boolean, options?: EditorOptions): Promise { // Show in editor control if the active editor changed - const openEditorPromise = this.editorControl.openEditor(editor, options); + let openEditorPromise: Promise; + if (active) { + openEditorPromise = (async () => { + try { + const result = await this.editorControl.openEditor(editor, options); + + // Editor change event + if (result.editorChanged) { + this._onDidGroupChange.fire({ kind: GroupChangeKind.EDITOR_ACTIVE, editor }); + } + + return result.control; + } catch (error) { + + // Handle errors but do not bubble them up + this.doHandleOpenEditorError(error, editor, options); + + return null; // error: return NULL as result to signal this + } + })(); + } else { + openEditorPromise = Promise.resolve(null); // inactive: return NULL as result to signal this + } // Show in title control after editor control because some actions depend on it this.titleAreaControl.openEditor(editor); - // Return opened editor to caller (can be NULL) - let openedEditor: IEditor | null = null; - if (active) { - try { - const result = await openEditorPromise; - - // Editor change event - if (result.editorChanged) { - this._onDidGroupChange.fire({ kind: GroupChangeKind.EDITOR_ACTIVE, editor }); - } - - openedEditor = result.control; - } catch (error) { - - // Handle errors but do not bubble them up - this.doHandleOpenEditorError(error, editor, options); - } - } else { - openedEditor = null; // inactive: return NULL as result to signal this - } - - return openedEditor; + return openEditorPromise; } private doHandleOpenEditorError(error: Error, editor: EditorInput, options?: EditorOptions): void { From b00f75af22fe1b891dd7f84f4574e9953b527d0b Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Fri, 31 May 2019 08:41:13 -0700 Subject: [PATCH 06/10] Fix #74659, make sync icon smaller --- cgmanifest.json | 4 ++-- .../ui/octiconLabel/octicons/octicons.css | 4 ++-- .../ui/octiconLabel/octicons/octicons.svg | 2 +- .../ui/octiconLabel/octicons/octicons.ttf | Bin 37520 -> 37504 bytes 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cgmanifest.json b/cgmanifest.json index e58378fb632..406060f8a7a 100644 --- a/cgmanifest.json +++ b/cgmanifest.json @@ -111,11 +111,11 @@ "git": { "name": "vscode-octicons-font", "repositoryUrl": "https://github.com/Microsoft/vscode-octicons-font", - "commitHash": "d9b9724beb850c6d038afe1cc1d46ba89a6a10ac" + "commitHash": "415cd5b42ab699b6b46c0bf011ada0a2ae50bfb4" } }, "license": "MIT", - "version": "1.3.0" + "version": "1.3.1" }, { "component": { diff --git a/src/vs/base/browser/ui/octiconLabel/octicons/octicons.css b/src/vs/base/browser/ui/octiconLabel/octicons/octicons.css index 06e4d2ebd41..d9cc1b7a4fa 100644 --- a/src/vs/base/browser/ui/octiconLabel/octicons/octicons.css +++ b/src/vs/base/browser/ui/octiconLabel/octicons/octicons.css @@ -1,7 +1,7 @@ @font-face { font-family: "octicons"; - src: url("./octicons.ttf?f6919d21f641711143d5590f9de474df") format("truetype"), -url("./octicons.svg?f6919d21f641711143d5590f9de474df#octicons") format("svg"); + src: url("./octicons.ttf?1b0f2a9535896866c74dd24eedeb4374") format("truetype"), +url("./octicons.svg?1b0f2a9535896866c74dd24eedeb4374#octicons") format("svg"); } .octicon, .mega-octicon { diff --git a/src/vs/base/browser/ui/octiconLabel/octicons/octicons.svg b/src/vs/base/browser/ui/octiconLabel/octicons/octicons.svg index 3a131fef49a..3f4ab4f1807 100644 --- a/src/vs/base/browser/ui/octiconLabel/octicons/octicons.svg +++ b/src/vs/base/browser/ui/octiconLabel/octicons/octicons.svg @@ -507,7 +507,7 @@ horiz-adv-x="875" d=" M625 757.5H250L0 507.5V132.5L250 -117.5H625L875 132.5V507.5L625 757.5zM812.5 163.75L593.75 -55H281.25L62.5 163.75V476.25L281.25 695H593.75L812.5 476.25V163.75zM375 570H500V257.5H375V570zM375 195H500V70H375V195z" /> + horiz-adv-x="750" d=" M640 357.5A259.37500000000006 259.37500000000006 0 0 0 565.0000000000001 132.5A271.625 271.625 0 0 0 226.8750000000001 98.75L300 170L31.25 207.5L68.75 -55L150.625 23.75C298.125 -85 506.8749999999999 -74.375 640.625 57.5A367.25 367.25 0 0 1 749.375 336.2500000000001L640 357.5000000000001zM185 507.5A271.625 271.625 0 0 0 523.1250000000001 541.25L450 470L718.75 432.5000000000001L681.25 695L599.375 616.25C451.875 725.0000000000001 243.125 714.3750000000001 108.75 582.5C31.25 505.625 -3.75 404.375 0.625 303.75L110 281.875A260.625 260.625 0 0 0 185 507.5z" /> diff --git a/src/vs/base/browser/ui/octiconLabel/octicons/octicons.ttf b/src/vs/base/browser/ui/octiconLabel/octicons/octicons.ttf index 16af700eff20656e33733c0e5afb3e74d63decf3..4eb17f9045c32dfdff2f5489fe76b3ed7323c733 100644 GIT binary patch delta 382 zcmbQRl&N7U(*)(jas~#*9tH-6u;kpt0^@XnWCjM72Mi3na_KphX~o`OQW+S88yFah zzhtB)rpRcRD*@F4Ai>9w1i9$StWTfB*kH(7Y!M3`~D=@{<$&__DPo zwkQjh00qPf@{3CzDIYLnVCd|bxWho^KetA9JipCX25#mTKm!J(uBRd-i$}_5&nKLzTX+)J)n|l8HtQO?CDKx^#+>+(*8C{SNBQI3QQbw93 zmrFyJG0na_Tth&~UG3jbe=|8LX-Bh3ervQrBC3r1Y!D#}FLz%tyKa-l*2T`^o?18**<{?Gpw<~*i945AFWK&OeZ^D(lssi~W*3Y*I@nwx>3x+;(m z6K7{-X4eBsf}lL38c>Gm6}OmpmYYkzZP>qKI`LuWQ__5$6%<(h=9##;Ot1-MwA6_Y zy#N-JXKnzhHDk>2aB<5N7ZcJ5*7 Date: Fri, 31 May 2019 10:01:31 -0700 Subject: [PATCH 07/10] Fix possible crash in winpty Fixes #74181 --- src/vs/workbench/contrib/terminal/node/terminalProcess.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vs/workbench/contrib/terminal/node/terminalProcess.ts b/src/vs/workbench/contrib/terminal/node/terminalProcess.ts index 66680de5575..c01ec8da5fe 100644 --- a/src/vs/workbench/contrib/terminal/node/terminalProcess.ts +++ b/src/vs/workbench/contrib/terminal/node/terminalProcess.ts @@ -200,6 +200,9 @@ export class TerminalProcess implements ITerminalChildProcess, IDisposable { if (this._isDisposed) { return; } + if (typeof cols !== 'number' || typeof rows !== 'number') { + return; + } // Ensure that cols and rows are always >= 1, this prevents a native // exception in winpty. if (this._ptyProcess) { From bd08ccfc3249587f89755b56782eeebff30c8584 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Fri, 31 May 2019 10:07:20 -0700 Subject: [PATCH 08/10] Actually fix the issue typeof NaN is number :/ --- src/vs/workbench/contrib/terminal/node/terminalProcess.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/terminal/node/terminalProcess.ts b/src/vs/workbench/contrib/terminal/node/terminalProcess.ts index c01ec8da5fe..3005784b6e9 100644 --- a/src/vs/workbench/contrib/terminal/node/terminalProcess.ts +++ b/src/vs/workbench/contrib/terminal/node/terminalProcess.ts @@ -200,7 +200,7 @@ export class TerminalProcess implements ITerminalChildProcess, IDisposable { if (this._isDisposed) { return; } - if (typeof cols !== 'number' || typeof rows !== 'number') { + if (typeof cols !== 'number' || typeof rows !== 'number' || isNaN(cols) || isNaN(rows)) { return; } // Ensure that cols and rows are always >= 1, this prevents a native From 1d4326066836a4ab386dcee48c3387da272c25e3 Mon Sep 17 00:00:00 2001 From: Peng Lyu Date: Fri, 31 May 2019 11:58:19 -0700 Subject: [PATCH 09/10] update distro --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0051335f779..1350d80a7e6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.35.0", - "distro": "78b820fcfbca46e0a1387efef3b8216e04100f45", + "distro": "cab40df703292bfd88267c5b1941205cbd04de62", "author": { "name": "Microsoft Corporation" }, From 0284236851a94b116f468345f6e98688a737015d Mon Sep 17 00:00:00 2001 From: Rachel Macfarlane Date: Fri, 31 May 2019 12:00:24 -0700 Subject: [PATCH 10/10] Fix #74668, old comment API not adding comments --- .../api/browser/mainThreadComments.ts | 23 +++++++++++++++++++ .../workbench/browser/web.simpleservices.ts | 2 ++ .../contrib/comments/browser/commentNode.ts | 5 ++++ .../comments/browser/commentService.ts | 9 ++++++++ .../comments/browser/commentThreadWidget.ts | 10 ++++++++ 5 files changed, 49 insertions(+) diff --git a/src/vs/workbench/api/browser/mainThreadComments.ts b/src/vs/workbench/api/browser/mainThreadComments.ts index 9a6f866362c..aa0e454810a 100644 --- a/src/vs/workbench/api/browser/mainThreadComments.ts +++ b/src/vs/workbench/api/browser/mainThreadComments.ts @@ -469,6 +469,9 @@ export class MainThreadComments extends Disposable implements MainThreadComments private _handlers = new Map(); private _commentControllers = new Map(); + private _activeCommentThread?: MainThreadCommentThread; + private _input?: modes.CommentInput; + private _openPanelListener: IDisposable | null; constructor( @@ -483,6 +486,26 @@ export class MainThreadComments extends Disposable implements MainThreadComments this._disposables = []; this._activeCommentThreadDisposables = []; this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostComments); + + this._disposables.push(this._commentService.onDidChangeActiveCommentThread(async thread => { + let handle = (thread as MainThreadCommentThread).controllerHandle; + let controller = this._commentControllers.get(handle); + + if (!controller) { + return; + } + + this._activeCommentThreadDisposables = dispose(this._activeCommentThreadDisposables); + this._activeCommentThread = thread as MainThreadCommentThread; + controller.activeCommentThread = this._activeCommentThread; + + this._activeCommentThreadDisposables.push(this._activeCommentThread.onDidChangeInput(input => { // todo, dispose + this._input = input; + this._proxy.$onCommentWidgetInputChange(handle, URI.parse(this._activeCommentThread!.resource), this._activeCommentThread!.range, 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); + })); } $registerCommentController(handle: number, id: string, label: string): void { diff --git a/src/vs/workbench/browser/web.simpleservices.ts b/src/vs/workbench/browser/web.simpleservices.ts index 3920c5d2d31..49385f06a2e 100644 --- a/src/vs/workbench/browser/web.simpleservices.ts +++ b/src/vs/workbench/browser/web.simpleservices.ts @@ -619,6 +619,7 @@ export class SimpleCommentService implements ICommentService { onDidSetAllCommentThreads: Event = Event.None; onDidUpdateCommentThreads: Event = Event.None; onDidChangeActiveCommentingRange: Event<{ range: Range; commentingRangesInfo: CommentingRanges; }> = Event.None; + onDidChangeActiveCommentThread: Event = Event.None; onDidSetDataProvider: Event = Event.None; onDidDeleteDataProvider: Event = Event.None; setDocumentComments: any; @@ -649,6 +650,7 @@ export class SimpleCommentService implements ICommentService { deleteReaction: any; getReactionGroup: any; toggleReaction: any; + setActiveCommentThread: any; } registerSingleton(ICommentService, SimpleCommentService, true); //#endregion diff --git a/src/vs/workbench/contrib/comments/browser/commentNode.ts b/src/vs/workbench/contrib/comments/browser/commentNode.ts index 56c2a8667f9..09e2426a914 100644 --- a/src/vs/workbench/contrib/comments/browser/commentNode.ts +++ b/src/vs/workbench/contrib/comments/browser/commentNode.ts @@ -424,12 +424,14 @@ export class CommentNode extends Disposable { uri: this._commentEditor.getModel()!.uri, value: this.comment.body.value }; + this.commentService.setActiveCommentThread(commentThread); this._commentEditorDisposables.push(this._commentEditor.onDidFocusEditorWidget(() => { commentThread.input = { uri: this._commentEditor!.getModel()!.uri, value: this.comment.body.value }; + this.commentService.setActiveCommentThread(commentThread); })); this._commentEditorDisposables.push(this._commentEditor.onDidChangeModelContent(e => { @@ -439,6 +441,7 @@ export class CommentNode extends Disposable { let input = commentThread.input; input.value = newVal; commentThread.input = input; + this.commentService.setActiveCommentThread(commentThread); } } })); @@ -486,6 +489,7 @@ export class CommentNode extends Disposable { uri: this._commentEditor.getModel()!.uri, value: newBody }; + this.commentService.setActiveCommentThread(commentThread); let commandId = this.comment.editCommand.id; let args = this.comment.editCommand.arguments || []; @@ -523,6 +527,7 @@ export class CommentNode extends Disposable { if (result.confirmed) { try { if (this.comment.deleteCommand) { + this.commentService.setActiveCommentThread(this.commentThread); let commandId = this.comment.deleteCommand.id; let args = this.comment.deleteCommand.arguments || []; diff --git a/src/vs/workbench/contrib/comments/browser/commentService.ts b/src/vs/workbench/contrib/comments/browser/commentService.ts index 4823e3aec3a..9b2286d4677 100644 --- a/src/vs/workbench/contrib/comments/browser/commentService.ts +++ b/src/vs/workbench/contrib/comments/browser/commentService.ts @@ -38,6 +38,7 @@ export interface ICommentService { readonly onDidSetResourceCommentInfos: Event; readonly onDidSetAllCommentThreads: Event; readonly onDidUpdateCommentThreads: Event; + readonly onDidChangeActiveCommentThread: Event; readonly onDidChangeActiveCommentingRange: Event<{ range: Range, commentingRangesInfo: CommentingRanges }>; readonly onDidSetDataProvider: Event; readonly onDidDeleteDataProvider: Event; @@ -69,6 +70,7 @@ export interface ICommentService { deleteReaction(owner: string, resource: URI, comment: Comment, reaction: CommentReaction): Promise; getReactionGroup(owner: string): CommentReaction[] | undefined; toggleReaction(owner: string, resource: URI, thread: CommentThread2, comment: Comment, reaction: CommentReaction): Promise; + setActiveCommentThread(commentThread: CommentThread | null): void; } export class CommentService extends Disposable implements ICommentService { @@ -89,6 +91,9 @@ export class CommentService extends Disposable implements ICommentService { private readonly _onDidUpdateCommentThreads: Emitter = this._register(new Emitter()); readonly onDidUpdateCommentThreads: Event = this._onDidUpdateCommentThreads.event; + private readonly _onDidChangeActiveCommentThread = this._register(new Emitter()); + readonly onDidChangeActiveCommentThread = this._onDidChangeActiveCommentThread.event; + private readonly _onDidChangeActiveCommentingRange: Emitter<{ range: Range, commentingRangesInfo: CommentingRanges @@ -109,6 +114,10 @@ export class CommentService extends Disposable implements ICommentService { super(); } + setActiveCommentThread(commentThread: CommentThread | null) { + this._onDidChangeActiveCommentThread.fire(commentThread); + } + setDocumentComments(resource: URI, commentInfos: ICommentInfo[]): void { this._onDidSetResourceCommentInfos.fire({ resource, commentInfos }); } diff --git a/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts b/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts index 9d11f9114bf..737fe7297d4 100644 --- a/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts +++ b/src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts @@ -211,6 +211,10 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget this._bodyElement = dom.$('.body'); container.appendChild(this._bodyElement); + + dom.addDisposableListener(this._bodyElement, dom.EventType.FOCUS_IN, e => { + this.commentService.setActiveCommentThread(this._commentThread); + }); } protected _fillHead(container: HTMLElement): void { @@ -265,6 +269,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget } else { const deleteCommand = (this._commentThread as modes.CommentThread2).deleteCommand; if (deleteCommand) { + this.commentService.setActiveCommentThread(this._commentThread); return this.commandService.executeCommand(deleteCommand.id, ...(deleteCommand.arguments || [])); } else if (this._commentEditor.getValue() === '') { this.commentService.disposeCommentThread(this._owner, this._commentThread.threadId!); @@ -516,6 +521,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget uri: this._commentEditor.getModel()!.uri, value: this._commentEditor.getValue() }; + this.commentService.setActiveCommentThread(this._commentThread); })); this._commentThreadDisposables.push(this._commentEditor.getModel()!.onDidChangeContent(() => { @@ -526,6 +532,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget newInput.value = modelContent; thread.input = newInput; } + this.commentService.setActiveCommentThread(this._commentThread); })); this._commentThreadDisposables.push((this._commentThread as modes.CommentThread2).onDidChangeInput(input => { @@ -727,6 +734,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget uri: this._commentEditor.getModel()!.uri, value: this._commentEditor.getValue() }; + this.commentService.setActiveCommentThread(this._commentThread); await this.commandService.executeCommand(acceptInputCommand.id, ...(acceptInputCommand.arguments || [])); })); @@ -751,6 +759,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget uri: this._commentEditor.getModel()!.uri, value: this._commentEditor.getValue() }; + this.commentService.setActiveCommentThread(this._commentThread); await this.commandService.executeCommand(command.id, ...(command.arguments || [])); })); }); @@ -821,6 +830,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget uri: this._commentEditor.getModel()!.uri, value: this._commentEditor.getValue() }; + this.commentService.setActiveCommentThread(this._commentThread); let commandId = commentThread.acceptInputCommand.id; let args = commentThread.acceptInputCommand.arguments || [];