@opensumi/ide-connection 2.18.4-rc-1655088231.0 → 2.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +42 -36
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -2,22 +2,22 @@
2
2
 
3
3
  基于 jsonrpc 完成多端远程调用场景,兼容 lsp 等通信方式
4
4
 
5
+
5
6
  ### opensumi 中使用
6
7
 
7
8
  **准备**
8
-
9
9
  1. 框架中服务分为运行在浏览器环境的 前端服务(frontService) 与运行在 node 环境的 后端服务(backService),服务在两端的实现方式是一致的
10
10
  2. 目前在 `tools/dev-tool` 中的启动逻辑中完成了服务的注册和获取逻辑,在具体功能模块中无需关心具体的通信注册获取逻辑
11
11
 
12
- **后端服务(backService)** 后端服务(backService) 即在 Web Server 暴露的能力,类似 web 应用框架中 controller 提供的请求响应逻辑
12
+ **后端服务(backService)**
13
+ 后端服务(backService) 即在 Web Server 暴露的能力,类似 web 应用框架中 controller提供的请求响应逻辑
13
14
 
14
15
  1. 注册服务
15
16
 
16
17
  `packages/file-service/src/node/index.ts`
17
-
18
18
  ```javascript
19
19
  import { FileSystemNodeOptions, FileService } from './file-service';
20
- import { servicePath } from '../common/index';
20
+ import {servicePath} from '../common/index';
21
21
 
22
22
  export class FileServiceModule extends NodeModule {
23
23
  providers = [{ token: 'FileServiceOptions', useValue: FileSystemNodeOptions.DEFAULT }];
@@ -36,25 +36,26 @@ export class FileServiceModule extends NodeModule {
36
36
  2. 服务调用
37
37
 
38
38
  `packages/file-tree/src/browser/index.ts`
39
-
40
39
  ```javascript
41
- import { servicePath as FileServicePath } from '@opensumi/ide-file-service';
40
+
41
+ import {servicePath as FileServicePath} from '@opensumi/ide-file-service';
42
42
 
43
43
  @Injectable()
44
44
  export class FileTreeModule extends BrowserModule {
45
- providers: Provider[] = [createFileTreeAPIProvider(FileTreeAPIImpl)];
46
- backServices = [
47
- {
48
- servicePath: FileServicePath,
49
- },
45
+
46
+ providers: Provider[] = [
47
+ createFileTreeAPIProvider(FileTreeAPIImpl),
50
48
  ];
49
+ backServices = [{
50
+ servicePath: FileServicePath,
51
+ }];
51
52
  }
53
+
52
54
  ```
53
55
 
54
56
  例如在 file-tree 模块中,首先在模块入口位置声明需要用到的 `backServices`,传入引用的服务 `servicePath`,与服务注册时的 `servicePath` 一致
55
57
 
56
58
  `packages/file-tree/src/browser/file-tree.service.ts`
57
-
58
59
  ```javascript
59
60
  import {servicePath as FileServicePath} from '@opensumi/ide-file-service';
60
61
 
@@ -70,13 +71,13 @@ export default class FileTreeService extends Disposable {
70
71
  @Autowired(CommandService)
71
72
  private commandService: CommandService;
72
73
 
73
- constructor(@Inject(FileServicePath) protected readonly fileService) {
74
+ constructor(@Inject(FileServicePath) protected readonly fileSevice) {
74
75
  super();
75
76
 
76
77
  this.getFiles();
77
78
  }
78
79
  createFile = async () => {
79
- const {content} = await this.fileService.resolveContent('/Users/franklife/work/ide/ac/ide-framework/tsconfig.json');
80
+ const {content} = await this.fileSevice.resolveContent('/Users/franklife/work/ide/ac/ide-framework/tsconfig.json');
80
81
  const file = await this.fileAPI.createFile({
81
82
  name: 'name' + Date.now() + '\n' + content,
82
83
  path: 'path' + Date.now(),
@@ -97,7 +98,7 @@ export default class FileTreeService extends Disposable {
97
98
  在 file-tree.service.ts 中通过 `servicePath` 进行注入,并直接调用在服务类上的方法
98
99
 
99
100
  ```javascript
100
- constructor(@Inject(FileServicePath) protected readonly fileService) {
101
+ constructor(@Inject(FileServicePath) protected readonly fileSevice) {
101
102
  super();
102
103
 
103
104
  this.getFiles();
@@ -107,30 +108,30 @@ constructor(@Inject(FileServicePath) protected readonly fileService) {
107
108
  方法调用会转换成一个远程调用进行响应,返回结果
108
109
 
109
110
  ```javascript
110
- const { content } = await this.fileService.resolveContent('/Users/franklife/work/ide/ac/ide-framework/tsconfig.json');
111
+ const {content} = await this.fileSevice.resolveContent('/Users/franklife/work/ide/ac/ide-framework/tsconfig.json');
111
112
  ```
112
113
 
113
- **前端服务(frontService)** 后端服务(backService) 即在 Browser 环境下运行的代码暴露的能力
114
+
115
+ **前端服务(frontService)**
116
+ 后端服务(backService) 即在 Browser 环境下运行的代码暴露的能力
114
117
 
115
118
  1. 注册服务
116
119
 
117
120
  `packages/file-ree/src/browser/index.ts`
118
-
119
121
  ```javascript
120
122
  @Injectable()
121
123
  export class FileTreeModule extends BrowserModule {
122
- providers: Provider[] = [createFileTreeAPIProvider(FileTreeAPIImpl)];
123
- backServices = [
124
- {
125
- servicePath: FileServicePath,
126
- },
127
- ];
128
- frontServices = [
129
- {
130
- servicePath: FileTreeServicePath,
131
- token: FileTreeService,
132
- },
124
+
125
+ providers: Provider[] = [
126
+ createFileTreeAPIProvider(FileTreeAPIImpl),
133
127
  ];
128
+ backServices = [{
129
+ servicePath: FileServicePath,
130
+ }];
131
+ frontServices = [{
132
+ servicePath: FileTreeServicePath,
133
+ token: FileTreeService,
134
+ }];
134
135
  }
135
136
  ```
136
137
 
@@ -139,9 +140,8 @@ export class FileTreeModule extends BrowserModule {
139
140
  2. 服务使用
140
141
 
141
142
  `packages/file-service/src/node/index.ts`
142
-
143
143
  ```javascript
144
- import { servicePath as FileTreeServicePath } from '@opensumi/ide-file-tree';
144
+ import {servicePath as FileTreeServicePath} from '@opensumi/ide-file-tree';
145
145
 
146
146
  @Injectable()
147
147
  export class FileServiceModule extends NodeModule {
@@ -164,7 +164,6 @@ export class FileServiceModule extends NodeModule {
164
164
  与使用后端服务一致,在模块定义中声明需要使用的前端服务 `frontServices`,传入前端服务注册时用的 `servicePath` 一致
165
165
 
166
166
  `packages/file-service/src/node/file-service.ts`
167
-
168
167
  ```javascript
169
168
  @Injectable()
170
169
  export class FileService implements IFileService {
@@ -193,10 +192,17 @@ export class FileService implements IFileService {
193
192
  ```
194
193
 
195
194
  方法调用会转换成一个远程调用进行响应,返回结果
196
-
197
195
  ```javascript
198
- const fileTree = await this.fileTreeService;
199
- fileTree.fileName(uri.substr(-5));
196
+ const fileTree = await this.fileTreeService
197
+ fileTree.fileName(uri.substr(-5))
200
198
  ```
201
199
 
202
- 与后端服务调用区别的是,目前因前端代码后置执行,所以首先需要获取服务 `await this.fileTreeService` 后进行调用
200
+ 与后端服务调用区别的是,目前因前端代码后置执行,所以首先需要获取服务 `await thie.fileTreeService` 后进行调用
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/ide-connection",
3
- "version": "2.18.4-rc-1655088231.0",
3
+ "version": "2.18.4",
4
4
  "files": [
5
5
  "lib"
6
6
  ],
@@ -16,15 +16,15 @@
16
16
  "url": "git@github.com:opensumi/core.git"
17
17
  },
18
18
  "dependencies": {
19
- "@opensumi/ide-core-common": "2.18.4-rc-1655088231.0",
19
+ "@opensumi/ide-core-common": "2.18.4",
20
20
  "@opensumi/vscode-jsonrpc": "^8.0.0-next.2",
21
21
  "path-match": "^1.2.4",
22
22
  "ws": "^7.2.0"
23
23
  },
24
24
  "devDependencies": {
25
- "@opensumi/ide-components": "2.18.4-rc-1655088231.0",
25
+ "@opensumi/ide-components": "2.18.4",
26
26
  "@opensumi/ide-dev-tool": "^1.3.1",
27
27
  "mock-socket": "^9.0.2"
28
28
  },
29
- "gitHead": "2e9fd9e91988a30c1834a4b0709f30d23d22e04f"
29
+ "gitHead": "d986d61bfb88b746423e5372e67739a7eac78f33"
30
30
  }