Skip to content

Commit

Permalink
[core] remove a dep to native-keymap from node module
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
  • Loading branch information
akosyakov committed Apr 11, 2019
1 parent 4dc74a5 commit d380b17
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
},
{
"frontend": "lib/browser/keyboard/browser-keyboard-module",
"frontendElectron": "lib/electron-browser/keyboard/electron-keyboard-module"
"frontendElectron": "lib/electron-browser/keyboard/electron-keyboard-module",
"backendElectron": "lib/electron-main/keyboard/electron-backend-keyboard-module"
}
],
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/********************************************************************************
* Copyright (C) 2019 TypeFox and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the Eclipse
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
* with the GNU Classpath Exception which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

import { ContainerModule } from 'inversify';
import { ConnectionHandler, JsonRpcConnectionHandler } from '../../common/messaging';
import { KeyboardLayoutProvider, keyboardPath } from '../../common/keyboard/keyboard-layout-provider';
import { ElectronKeyboardLayoutProvider } from './electron-keyboard-layout-provider';

export default new ContainerModule(bind => {
bind(ElectronKeyboardLayoutProvider).toSelf().inSingletonScope();
bind(KeyboardLayoutProvider).toService(ElectronKeyboardLayoutProvider);
bind(ConnectionHandler).toDynamicValue(ctx =>
new JsonRpcConnectionHandler(keyboardPath, () =>
ctx.container.get(KeyboardLayoutProvider)
)
).inSingletonScope();
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { injectable } from 'inversify';
import { KeyboardLayoutProvider, NativeKeyboardLayout } from '../../common/keyboard/keyboard-layout-provider';

@injectable()
export class NativeKeyboardLayoutProvider implements KeyboardLayoutProvider {
export class ElectronKeyboardLayoutProvider implements KeyboardLayoutProvider {

getNativeLayout(): Promise<NativeKeyboardLayout> {
return Promise.resolve(this.getNativeLayoutSync());
Expand Down
10 changes: 0 additions & 10 deletions packages/core/src/node/backend-application-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ import { EnvVariablesServer, envVariablesPath } from './../common/env-variables'
import { EnvVariablesServerImpl } from './env-variables';
import { ConnectionContainerModule } from './messaging/connection-container-module';
import { QuickPickService, quickPickServicePath } from '../common/quick-pick-service';
import { KeyboardLayoutProvider, keyboardPath } from '../common/keyboard/keyboard-layout-provider';
import { NativeKeyboardLayoutProvider } from './keyboard/native-keyboard-layout-provider';

decorate(injectable(), ApplicationPackage);

Expand Down Expand Up @@ -83,12 +81,4 @@ export const backendApplicationModule = new ContainerModule(bind => {
const { projectPath } = container.get(BackendApplicationCliContribution);
return new ApplicationPackage({ projectPath });
}).inSingletonScope();

bind(NativeKeyboardLayoutProvider).toSelf().inSingletonScope();
bind(KeyboardLayoutProvider).toService(NativeKeyboardLayoutProvider);
bind(ConnectionHandler).toDynamicValue(ctx =>
new JsonRpcConnectionHandler(keyboardPath, () =>
ctx.container.get(KeyboardLayoutProvider)
)
).inSingletonScope();
});

0 comments on commit d380b17

Please sign in to comment.