Skip to content

Commit

Permalink
[keybinding] Align 'Close Editor' keybinding with VS Code across OSes
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Keromnes <jan.keromnes@typefox.io>
  • Loading branch information
jankeromnes committed Nov 29, 2019
1 parent ee1dd13 commit 3e41eb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [core] updated handling when access is denied to the clipboard [#6516](https://github.com/eclipse-theia/theia/pull/6516)
- [core] updated scrolling of widgets when re-setting their focus [#6621](https://github.com/eclipse-theia/theia/pull/6621)
- [core] upgraded `reconnecting-websocket` to latest version [#6512](https://github.com/eclipse-theia/theia/pull/6512)
- [core] aligned `New File`, `Close Editor` and `Close Window` keybindings with VS Code across OSes [#6635](https://github.com/eclipse-theia/theia/pull/6635)
- [cpp] moved the `cpp` extension to the [`theia-cpp-extensions`](https://github.com/eclipse-theia/theia-cpp-extensions) repo [#6505](https://github.com/eclipse-theia/theia/pull/6505)
- [debug] added ability to re-use the terminal based on label and caption [#6619](https://github.com/eclipse-theia/theia/pull/6619)
- [debug] added reloading of child variable nodes on `setValue` call [#6555](https://github.com/eclipse-theia/theia/pull/6555)
Expand Down
9 changes: 7 additions & 2 deletions packages/core/src/browser/common-frontend-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ import { AboutDialog } from './about-dialog';
import * as browser from './browser';
import URI from '../common/uri';
import { ContextKeyService } from './context-key-service';
import { OS, isOSX } from '../common/os';
import { OS, isOSX, isWindows } from '../common/os';
import { ResourceContextKey } from './resource-context-key';
import { UriSelection } from '../common/selection';
import { StorageService } from './storage-service';
import { Navigatable } from './navigatable';
import { QuickViewService } from './quick-view-service';
import { PrefixQuickOpenService } from './quick-open';
import { environment } from '@theia/application-package/lib/environment';

export namespace CommonMenus {

Expand Down Expand Up @@ -543,6 +544,10 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
return tabBar.currentTitle || undefined;
}

private isElectron(): boolean {
return environment.electron.is();
}

registerKeybindings(registry: KeybindingRegistry): void {
if (supportCut) {
registry.registerKeybinding({
Expand Down Expand Up @@ -599,7 +604,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
},
{
command: CommonCommands.CLOSE_TAB.id,
keybinding: 'alt+w'
keybinding: (!this.isElectron() ? 'alt+w' : (isWindows ? 'ctrl+f4' : 'ctrlcmd+w'))
},
{
command: CommonCommands.CLOSE_OTHER_TABS.id,
Expand Down

0 comments on commit 3e41eb8

Please sign in to comment.