Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/editor/browser/config/tabFocus.ts
5240 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { Emitter, Event } from '../../../base/common/event.js';
7
import { Disposable } from '../../../base/common/lifecycle.js';
8
9
class TabFocusImpl extends Disposable {
10
private _tabFocus: boolean = false;
11
private readonly _onDidChangeTabFocus = this._register(new Emitter<boolean>());
12
public readonly onDidChangeTabFocus: Event<boolean> = this._onDidChangeTabFocus.event;
13
14
public getTabFocusMode(): boolean {
15
return this._tabFocus;
16
}
17
18
public setTabFocusMode(tabFocusMode: boolean): void {
19
this._tabFocus = tabFocusMode;
20
this._onDidChangeTabFocus.fire(this._tabFocus);
21
}
22
}
23
24
/**
25
* Control what pressing Tab does.
26
* If it is false, pressing Tab or Shift-Tab will be handled by the editor.
27
* If it is true, pressing Tab or Shift-Tab will move the browser focus.
28
* Defaults to false.
29
*/
30
export const TabFocus = new TabFocusImpl();
31
32