@opensumi/ide-preferences 2.18.3 → 2.18.4-rc-1655088231.0

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 +13 -16
  2. package/package.json +8 -8
package/README.md CHANGED
@@ -3,15 +3,15 @@ id: main-layout
3
3
  title: 配置模块
4
4
  ---
5
5
 
6
- Preferences 模块主要用于管理整个IDE配置的读取逻辑,
6
+ Preferences 模块主要用于管理整个 IDE 配置的读取逻辑,
7
7
 
8
- 配置文件的目录位置可通过配置 `AppConfig` 中的 `userPreferenceDirName` 及 `workspacePreferenceDirName` 分别配置 全局配置 和 工作区配置的 `settings.json` 读取路径。
8
+ 配置文件的目录位置可通过配置 `AppConfig` 中的 `userPreferenceDirName` 及 `workspacePreferenceDirName` 分别配置 全局配置 和 工作区配置的 `settings.json` 读取路径。
9
9
 
10
10
  > 下面我们统一将 `.sumi` 作为我们默认的配置文件读取路径
11
11
 
12
12
  对于全局配置,我们一般是从 `~/.sumi/settings.json` 文件中读取;
13
13
 
14
- 针对工作区的配置文件,我们一般是从 `${worksace_path}/.sumi/settings.json` 文件中读取,但在存在多个工作区存在的`多工作区` 项目,我们则是从 `${workspace_name}.sumi-workspace` 文件中读取;
14
+ 针对工作区的配置文件,我们一般是从 `${workspace_path}/.sumi/settings.json` 文件中读取,但在存在多个工作区存在的`多工作区` 项目,我们则是从 `${workspace_name}.sumi-workspace` 文件中读取;
15
15
 
16
16
  你可以简单的通过如下方式来进行配置文件的修改,同时监听其变化:
17
17
 
@@ -38,8 +38,6 @@ export class Demo {
38
38
  }
39
39
  ```
40
40
 
41
-
42
-
43
41
  # 贡献点
44
42
 
45
43
  ## Contribution Providers
@@ -51,18 +49,18 @@ export class Demo {
51
49
  用于在框架中注册配置定义,你可以创建一个贡献点模块,在应用启动时引入该贡献点模块,来实现自定义的配置定义。
52
50
 
53
51
  ##### Example
54
- ```ts
55
52
 
53
+ ```ts
56
54
  // 定义一个 `general.language` 配置项
57
55
  const preferencesSchema: PreferenceSchema = {
58
- 'type': 'object',
56
+ type: 'object',
59
57
  properties: {
60
58
  'general.demo': {
61
59
  type: 'string',
62
60
  default: 'zh-CN',
63
61
  description: 'Demo preference%',
64
62
  },
65
- }
63
+ },
66
64
  };
67
65
 
68
66
  @Domain(PreferenceContribution)
@@ -76,11 +74,12 @@ export class DemoPreferenceContribution implements PreferenceContribution {
76
74
  如果你需要让你定义的配置出现在设置面板中,你还可以通过 `SettingContribution` 贡献点来定义。
77
75
 
78
76
  ##### Example
77
+
79
78
  ```ts
80
79
  // 在 `general` 面板追加一个 `general.demo` 配置项的展示
81
80
  @Domain(SettingContribution)
82
81
  export class DemoSettingContribution implements SettingContribution {
83
- handleSettingSections(settingSections: { [key: string]: ISettingSection[]; }) {
82
+ handleSettingSections(settingSections: { [key: string]: ISettingSection[] }) {
84
83
  return {
85
84
  ...settingSections,
86
85
  general: [
@@ -104,13 +103,13 @@ export class DemoSettingContribution implements SettingContribution {
104
103
 
105
104
  ### Command
106
105
 
107
- * `preference.open.user`: 打开用户配置文件
108
- * `preference.open.workspace`: 打开工作区配置文件
109
- * `core.openpreference`: 打开设置面板
106
+ - `preference.open.user`: 打开用户配置文件
107
+ - `preference.open.workspace`: 打开工作区配置文件
108
+ - `core.openpreference`: 打开设置面板
110
109
 
111
110
  ### KeyBinding
112
111
 
113
- * `ctrlcmd+,`: 打开设置面板
112
+ - `ctrlcmd+,`: 打开设置面板
114
113
 
115
114
  # 类
116
115
 
@@ -124,7 +123,6 @@ export class DemoSettingContribution implements SettingContribution {
124
123
 
125
124
  #### `ready`
126
125
 
127
-
128
126
  ```ts
129
127
  ready: Promise<void>;
130
128
  ```
@@ -153,7 +151,7 @@ ready: Promise<void>;
153
151
 
154
152
  ```ts
155
153
  /**
156
- *
154
+ *
157
155
  * @param preferenceName 配置名称
158
156
  * @param defaultValue 默认值
159
157
  * @param resourceUri 资源路径
@@ -172,7 +170,6 @@ ready: Promise<void>;
172
170
 
173
171
  配置变更事件,这里会获取到一个配置变更的集合。
174
172
 
175
-
176
173
  #### `onPreferenceChanged()`
177
174
 
178
175
  ```ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/ide-preferences",
3
- "version": "2.18.3",
3
+ "version": "2.18.4-rc-1655088231.0",
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.3"
19
+ "@opensumi/ide-core-common": "2.18.4-rc-1655088231.0"
20
20
  },
21
21
  "devDependencies": {
22
- "@opensumi/ide-components": "2.18.3",
23
- "@opensumi/ide-core-browser": "2.18.3",
22
+ "@opensumi/ide-components": "2.18.4-rc-1655088231.0",
23
+ "@opensumi/ide-core-browser": "2.18.4-rc-1655088231.0",
24
24
  "@opensumi/ide-dev-tool": "^1.3.1",
25
- "@opensumi/ide-editor": "2.18.3",
26
- "@opensumi/ide-file-service": "2.18.3",
27
- "@opensumi/ide-workspace": "2.18.3"
25
+ "@opensumi/ide-editor": "2.18.4-rc-1655088231.0",
26
+ "@opensumi/ide-file-service": "2.18.4-rc-1655088231.0",
27
+ "@opensumi/ide-workspace": "2.18.4-rc-1655088231.0"
28
28
  },
29
- "gitHead": "7e10dbebe40ce48e1e1e3defaf96180c461f8888"
29
+ "gitHead": "2e9fd9e91988a30c1834a4b0709f30d23d22e04f"
30
30
  }