API: window.isFocused, window.onDidChangeWindowFocus

fixes #18263
This commit is contained in:
Joao Moreno
2017-07-20 14:45:41 +02:00
parent 7f503e89d3
commit 6987cb0eb0
6 changed files with 105 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ import { ExtHostApiCommands } from 'vs/workbench/api/node/extHostApiCommands';
import { ExtHostTask } from 'vs/workbench/api/node/extHostTask';
import { ExtHostDebugService } from 'vs/workbench/api/node/extHostDebugService';
import { ExtHostCredentials } from 'vs/workbench/api/node/extHostCredentials';
import { ExtHostWindow } from 'vs/workbench/api/node/extHostWindow';
import * as extHostTypes from 'vs/workbench/api/node/extHostTypes';
import URI from 'vs/base/common/uri';
import Severity from 'vs/base/common/severity';
@@ -96,6 +97,7 @@ export function createApiFactory(
const extHostSCM = col.define(ExtHostContext.ExtHostSCM).set<ExtHostSCM>(new ExtHostSCM(threadService, extHostCommands));
const extHostTask = col.define(ExtHostContext.ExtHostTask).set<ExtHostTask>(new ExtHostTask(threadService));
const extHostCredentials = col.define(ExtHostContext.ExtHostCredentials).set<ExtHostCredentials>(new ExtHostCredentials(threadService));
const extHostWindow = col.define(ExtHostContext.ExtHostWindow).set<ExtHostWindow>(new ExtHostWindow(threadService));
col.define(ExtHostContext.ExtHostExtensionService).set(extensionService);
col.finish(false, threadService);
@@ -308,6 +310,12 @@ export function createApiFactory(
onDidCloseTerminal(listener, thisArg?, disposables?) {
return extHostTerminalService.onDidCloseTerminal(listener, thisArg, disposables);
},
get isFocused() {
return extHostWindow.isFocused;
},
onDidChangeWindowFocus: proposedApiFunction(extension, (listener, thisArg?, disposables?) => {
return extHostWindow.onDidChangeWindowFocus(listener, thisArg, disposables);
}),
showInformationMessage(message, first, ...rest) {
return extHostMessageService.showMessage(Severity.Info, message, first, rest);
},