Skip to content

Commit 0a0d3ec

Browse files
authored
Fix depreated imports. (#239)
Signed-off-by: counter2015 <voidcounter@gmail.com>
1 parent ee430a4 commit 0a0d3ec

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

templates/backend/backend-module.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ConnectionHandler, JsonRpcConnectionHandler } from '@theia/core';
1+
import { ConnectionHandler, RpcConnectionHandler } from '@theia/core';
22
import { ContainerModule } from '@theia/core/shared/inversify';
33
import { BackendClient, HelloBackendWithClientService, HelloBackendService, HELLO_BACKEND_PATH, HELLO_BACKEND_WITH_CLIENT_PATH } from '../common/protocol';
44
import { HelloBackendWithClientServiceImpl } from './hello-backend-with-client-service';
@@ -7,14 +7,14 @@ import { HelloBackendServiceImpl } from './hello-backend-service';
77
export default new ContainerModule(bind => {
88
bind(HelloBackendService).to(HelloBackendServiceImpl).inSingletonScope()
99
bind(ConnectionHandler).toDynamicValue(ctx =>
10-
new JsonRpcConnectionHandler(HELLO_BACKEND_PATH, () => {
10+
new RpcConnectionHandler(HELLO_BACKEND_PATH, () => {
1111
return ctx.container.get<HelloBackendService>(HelloBackendService);
1212
})
1313
).inSingletonScope();
1414

1515
bind(HelloBackendWithClientService).to(HelloBackendWithClientServiceImpl).inSingletonScope()
1616
bind(ConnectionHandler).toDynamicValue(ctx =>
17-
new JsonRpcConnectionHandler<BackendClient>(HELLO_BACKEND_WITH_CLIENT_PATH, client => {
17+
new RpcConnectionHandler<BackendClient>(HELLO_BACKEND_WITH_CLIENT_PATH, client => {
1818
const server = ctx.container.get<HelloBackendWithClientServiceImpl>(HelloBackendWithClientService);
1919
server.setClient(client);
2020
client.onDidCloseConnection(() => server.dispose());

templates/backend/frontend-module.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
import { CommandContribution} from '@theia/core';
2-
import { WebSocketConnectionProvider } from '@theia/core/lib/browser';
2+
import { RemoteConnectionProvider, ServiceConnectionProvider } from '@theia/core/lib/browser';
33
import { ContainerModule, injectable } from '@theia/core/shared/inversify';
44
import { BackendClient, HelloBackendWithClientService, HelloBackendService, HELLO_BACKEND_PATH, HELLO_BACKEND_WITH_CLIENT_PATH } from '../common/protocol';
55
import { <%= params.extensionPrefix %>CommandContribution} from './<%= params.extensionPath %>-contribution';
66

77
export default new ContainerModule(bind => {
88
bind(CommandContribution).to(<%= params.extensionPrefix %>CommandContribution).inSingletonScope();
99
bind(BackendClient).to(BackendClientImpl).inSingletonScope();
10+
bind(ServiceConnectionProvider).toSelf().inSingletonScope();
1011

1112
bind(HelloBackendService).toDynamicValue(ctx => {
12-
const connection = ctx.container.get(WebSocketConnectionProvider);
13-
return connection.createProxy<HelloBackendService>(HELLO_BACKEND_PATH);
13+
const connection = ctx.container.get<ServiceConnectionProvider>(RemoteConnectionProvider);
14+
return connection.createProxy(HELLO_BACKEND_PATH);
1415
}).inSingletonScope();
1516

1617
bind(HelloBackendWithClientService).toDynamicValue(ctx => {
17-
const connection = ctx.container.get(WebSocketConnectionProvider);
18+
const connection = ctx.container.get<ServiceConnectionProvider>(RemoteConnectionProvider);
1819
const backendClient: BackendClient = ctx.container.get(BackendClient);
19-
return connection.createProxy<HelloBackendWithClientService>(HELLO_BACKEND_WITH_CLIENT_PATH, backendClient);
20+
return connection.createProxy(HELLO_BACKEND_WITH_CLIENT_PATH, backendClient);
2021
}).inSingletonScope();
2122
});
2223

templates/backend/protocol.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { JsonRpcServer } from '@theia/core/lib/common/messaging';
1+
import { RpcServer } from '@theia/core/lib/common/messaging';
22

33
export const HelloBackendService = Symbol('HelloBackendService');
44
export const HELLO_BACKEND_PATH = '/services/helloBackend';
@@ -9,7 +9,7 @@ export interface HelloBackendService {
99
export const HelloBackendWithClientService = Symbol('BackendWithClient');
1010
export const HELLO_BACKEND_WITH_CLIENT_PATH = '/services/withClient';
1111

12-
export interface HelloBackendWithClientService extends JsonRpcServer<BackendClient> {
12+
export interface HelloBackendWithClientService extends RpcServer<BackendClient> {
1313
greet(): Promise<string>
1414
}
1515
export const BackendClient = Symbol('BackendClient');

0 commit comments

Comments
 (0)