diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index 9b5e91bd553..2db613f321e 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -141,7 +141,8 @@ export class CodeWindow implements ICodeWindow { title: product.nameLong, webPreferences: { 'backgroundThrottling': false, // by default if Code is in the background, intervals and timeouts get throttled, - disableBlinkFeatures: 'Auxclick' // disable auxclick events (see https://developers.google.com/web/updates/2016/10/auxclick) + disableBlinkFeatures: 'Auxclick', // disable auxclick events (see https://developers.google.com/web/updates/2016/10/auxclick) + experimentalFeatures: true } }; diff --git a/src/vs/workbench/api/electron-browser/mainThreadComments.ts b/src/vs/workbench/api/electron-browser/mainThreadComments.ts index c8d3eca7a9c..572d4047325 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadComments.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadComments.ts @@ -5,7 +5,7 @@ 'use strict'; import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle'; -import { ICodeEditor, getCodeEditor } from 'vs/editor/browser/editorBrowser'; +import { ICodeEditor, isCodeEditor, isDiffEditor, getCodeEditor, IDiffEditor } from 'vs/editor/browser/editorBrowser'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import * as modes from 'vs/editor/common/modes'; import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers'; @@ -37,23 +37,25 @@ export class MainThreadComments extends Disposable implements MainThreadComments this._disposables = []; this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostComments); this._disposables.push(this._editorService.onDidActiveEditorChange(e => { - const outerEditor = this.getFocusedEditor(); - if (!outerEditor) { + const editors = this.getFocusedEditors(); + if (!editors || !editors.length) { return; } - const controller = ReviewController.get(outerEditor); - if (!controller) { - return; - } + editors.forEach(editor => { + const controller = ReviewController.get(editor); + if (!controller) { + return; + } - if (!outerEditor.getModel()) { - return; - } + if (!editor.getModel()) { + return; + } - const outerEditorURI = outerEditor.getModel().uri; - this.provideDocumentComments(outerEditorURI).then(commentInfos => { - this._commentService.setDocumentComments(outerEditorURI, commentInfos.filter(info => info !== null)); + const outerEditorURI = editor.getModel().uri; + this.provideDocumentComments(outerEditorURI).then(commentInfos => { + this._commentService.setDocumentComments(outerEditorURI, commentInfos.filter(info => info !== null)); + }); }); })); } @@ -115,8 +117,25 @@ export class MainThreadComments extends Disposable implements MainThreadComments this._documentProviders.clear(); } - getFocusedEditor(): ICodeEditor { - return this._codeEditorService.getFocusedCodeEditor() || getCodeEditor(this._editorService.activeControl); + getFocusedEditors(): ICodeEditor[] { + let activeControl = this._editorService.activeControl; + if (activeControl) { + if (isCodeEditor(activeControl.getControl())) { + return [this._editorService.activeControl.getControl() as ICodeEditor]; + } + + if (isDiffEditor(activeControl.getControl())) { + let diffEditor = activeControl.getControl() as IDiffEditor; + return [diffEditor.getOriginalEditor(), diffEditor.getModifiedEditor()]; + } + } + + let editor = this._codeEditorService.getFocusedCodeEditor(); + + if (editor) { + return [editor]; + } + return []; } async provideWorkspaceComments(): Promise {