@opensumi/ide-preferences 2.20.3 → 2.20.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.
@@ -0,0 +1,36 @@
1
+ .preference-view {
2
+ margin: 40;
3
+ height: 100%;
4
+ color: #ccc;
5
+ .scope-select {
6
+ position: fixed;
7
+ right: 100px;
8
+ }
9
+ .preference-line {
10
+ margin: 40px;
11
+ }
12
+ .key {
13
+ font-weight: bold;
14
+ }
15
+ .control-wrap {
16
+ color: #fff;
17
+ select,
18
+ input {
19
+ border: none;
20
+ background: #333;
21
+ padding: 3px 5px;
22
+ }
23
+ }
24
+ .desc {
25
+ }
26
+ .text-control {
27
+ max-width: 500px;
28
+ width: 100%;
29
+ }
30
+ .select-control {
31
+ width: 300px;
32
+ }
33
+ .number-control {
34
+ width: 300px;
35
+ }
36
+ }
@@ -1,6 +1,5 @@
1
- import { IBasicRecycleTreeHandle, IRecycleTreeHandle } from '@opensumi/ide-components';
2
- import { IVirtualListHandle } from '@opensumi/ide-components/lib/virtual-list/types';
3
- import { IPreferenceViewDesc, IPreferenceSettingsService, ISettingGroup, ISettingSection, PreferenceProviderProvider, Event, CommandService, PreferenceScope, PreferenceSchemaProvider, IDisposable, PreferenceService, IResolvedSettingSection } from '@opensumi/ide-core-browser';
1
+ import { IRecycleListHandler } from '@opensumi/ide-components';
2
+ import { IPreferenceViewDesc, IPreferenceSettingsService, ISettingGroup, ISettingSection, PreferenceProviderProvider, Event, CommandService, PreferenceScope, PreferenceSchemaProvider, IDisposable, PreferenceService } from '@opensumi/ide-core-browser';
4
3
  import { IFileServiceClient } from '@opensumi/ide-file-service';
5
4
  export declare class PreferenceSettingsService implements IPreferenceSettingsService {
6
5
  private static DEFAULT_CHANGE_DELAY;
@@ -18,8 +17,6 @@ export declare class PreferenceSettingsService implements IPreferenceSettingsSer
18
17
  private enumLabels;
19
18
  private cachedGroupSection;
20
19
  private _listHandler;
21
- private _treeHandler;
22
- private _basicTreeHandler;
23
20
  private onDidEnumLabelsChangeEmitter;
24
21
  private enumLabelsChangeDelayer;
25
22
  private onDidSettingsChangeEmitter;
@@ -38,12 +35,8 @@ export declare class PreferenceSettingsService implements IPreferenceSettingsSer
38
35
  * @param scope 作用域
39
36
  */
40
37
  setPreference(key: string, value: any, scope: PreferenceScope): Promise<void>;
41
- get listHandler(): import("react-virtuoso").VirtuosoHandle;
42
- handleListHandler: (handler: IVirtualListHandle) => void;
43
- get treeHandler(): IRecycleTreeHandle;
44
- handleTreeHandler: (handler: any) => void;
45
- get basicTreeHandler(): IBasicRecycleTreeHandle;
46
- handleBasicTreeHandler: (handler: any) => void;
38
+ get listHandler(): IRecycleListHandler;
39
+ handleListHandler: (handler: any) => void;
47
40
  /**
48
41
  * 获取搜索条件下展示的设置面板配置组
49
42
  * @param scope 作用域
@@ -62,7 +55,6 @@ export declare class PreferenceSettingsService implements IPreferenceSettingsSer
62
55
  * @param section 配置项内容
63
56
  */
64
57
  registerSettingSection(groupId: string, section: ISettingSection): IDisposable;
65
- visitSection(section: ISettingSection, cb: (v: IPreferenceViewDesc) => boolean | undefined): IPreferenceViewDesc | undefined;
66
58
  /**
67
59
  * 通过配置项ID获取配置项展示信息
68
60
  * @param preferenceId 配置项ID
@@ -74,7 +66,7 @@ export declare class PreferenceSettingsService implements IPreferenceSettingsSer
74
66
  * @param scope 作用域
75
67
  * @param search 搜索条件
76
68
  */
77
- getResolvedSections(groupId: string, scope: PreferenceScope, search?: string): IResolvedSettingSection[];
69
+ getSections(groupId: string, scope: PreferenceScope, search?: string): ISettingSection[];
78
70
  /**
79
71
  * 获取某个配置名在特定作用域下的值
80
72
  * @param preferenceName 配置名
@@ -1 +1 @@
1
- {"version":3,"file":"preference-settings.service.d.ts","sourceRoot":"","sources":["../../src/browser/preference-settings.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACvF,OAAO,EAAE,kBAAkB,E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M,CAAA;KAAE;IAIhE;;;;OAIG;IACH,aAAa,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE;IAUvE;;;;OAIG;IACG,KAAK,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe;IAI1D;;;OAGG;IACG,gBAAgB,CAAC,KAAK,EAAE,eAAe;IAW7C;;;OAGG;IACG,uBAAuB,CAAC,KAAK,CAAC,EAAE,eAAe;IAgBrD;;;OAGG;IACH,MAAM,UAAW,MAAM,UAErB;IAEF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsC;IAE/D,IAAI,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,CAEzB;IAED,UAAU;CAGX;AAED,eAAO,MAAM,mBAAmB,EAAE,aAAa,EA0B9C,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CAAC;CAmQlC,CAAC"}
1
+ {"version":3,"file":"preference-settings.service.d.ts","sourceRoot":"","sources":["../../src/browser/preference-settings.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,aAAa,EACb,eAAe,EACf,0BAA0B,EAE1B,KAAK,EACL,cAAc,EAId,eAAe,EAEf,wBAAwB,EACxB,WAAW,EAGX,iBAAiB,EAIlB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAOhE,qBACa,yBAA0B,YAAW,0BAA0B;IAC1E,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAO;IAG1C,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAGxD,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,wBAAwB,CAAC;IAG5D,SAA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,wBAAwB,CAAC,YAAY,EAAE,MAAM;IAe7C;;;;;OAKG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,eAAe,EAAE;IA+CxF;;;;;OAKG;IACH,aAAa,CACX,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,eAAe,EACtB,SAAS,UAAQ,GAChB;QAAE,KAAK,EAAE,GAAG,CAAC;QAAC,cAAc,EAAE,eAAe,CAAA;KAAE;IAelD;;;OAGG;IACH,aAAa,CAAC,cAAc,EAAE,MAAM,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE;IAIhE;;;;OAIG;IACH,aAAa,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE;IAUvE;;;;OAIG;IACG,KAAK,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe;IAI1D;;;OAGG;IACG,gBAAgB,CAAC,KAAK,EAAE,eAAe;IAW7C;;;OAGG;IACG,uBAAuB,CAAC,KAAK,CAAC,EAAE,eAAe;IAgBrD;;;OAGG;IACH,MAAM,UAAW,MAAM,UAErB;IAEF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsC;IAE/D,IAAI,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,CAEzB;IAED,UAAU;CAGX;AAED,eAAO,MAAM,mBAAmB,EAAE,aAAa,EA0B9C,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CAAC;CA8NlC,CAAC"}
@@ -28,12 +28,6 @@ let PreferenceSettingsService = PreferenceSettingsService_1 = class PreferenceSe
28
28
  this.handleListHandler = (handler) => {
29
29
  this._listHandler = handler;
30
30
  };
31
- this.handleTreeHandler = (handler) => {
32
- this._treeHandler = handler;
33
- };
34
- this.handleBasicTreeHandler = (handler) => {
35
- this._basicTreeHandler = handler;
36
- };
37
31
  /**
38
32
  * 在设置面板下搜索配置
39
33
  * @param value 搜索值
@@ -43,7 +37,7 @@ let PreferenceSettingsService = PreferenceSettingsService_1 = class PreferenceSe
43
37
  };
44
38
  this._onFocus = new ide_core_browser_1.Emitter();
45
39
  this.setEnumLabels('general.language', new Proxy({}, {
46
- get: (target, key) => { var _a; return (_a = (0, ide_core_browser_1.getAvailableLanguages)().find((l) => l.languageId === key)) === null || _a === void 0 ? void 0 : _a.localizedLanguageName; },
40
+ get: (target, key) => (0, ide_core_browser_1.getAvailableLanguages)().find((l) => l.languageId === key).localizedLanguageName,
47
41
  }));
48
42
  this.setEnumLabels('files.eol', {
49
43
  '\n': 'LF',
@@ -71,7 +65,9 @@ let PreferenceSettingsService = PreferenceSettingsService_1 = class PreferenceSe
71
65
  return value.toLocaleLowerCase().indexOf(search.toLocaleLowerCase()) > -1;
72
66
  }
73
67
  filterPreferences(preference, scope) {
74
- return Array.isArray(preference.hiddenInScope) && preference.hiddenInScope.includes(scope);
68
+ return (typeof preference !== 'string' &&
69
+ Array.isArray(preference.hiddenInScope) &&
70
+ preference.hiddenInScope.includes(scope));
75
71
  }
76
72
  doSearch(value) {
77
73
  if (value) {
@@ -93,12 +89,6 @@ let PreferenceSettingsService = PreferenceSettingsService_1 = class PreferenceSe
93
89
  get listHandler() {
94
90
  return this._listHandler;
95
91
  }
96
- get treeHandler() {
97
- return this._treeHandler;
98
- }
99
- get basicTreeHandler() {
100
- return this._basicTreeHandler;
101
- }
102
92
  /**
103
93
  * 获取搜索条件下展示的设置面板配置组
104
94
  * @param scope 作用域
@@ -107,7 +97,7 @@ let PreferenceSettingsService = PreferenceSettingsService_1 = class PreferenceSe
107
97
  getSettingGroups(scope, search) {
108
98
  this.currentScope = scope;
109
99
  const groups = this.settingsGroups.slice();
110
- return groups.filter((g) => this.getResolvedSections(g.id, scope, search).length > 0);
100
+ return groups.filter((g) => this.getSections(g.id, scope, search).length > 0);
111
101
  }
112
102
  async hasThisScopeSetting(scope) {
113
103
  const url = await this.getPreferenceUrl(scope);
@@ -122,7 +112,7 @@ let PreferenceSettingsService = PreferenceSettingsService_1 = class PreferenceSe
122
112
  * @param group 配置组
123
113
  */
124
114
  registerSettingGroup(group) {
125
- const disposable = addElement(this.settingsGroups, Object.assign(Object.assign({}, group), { title: (0, ide_core_browser_1.replaceLocalizePlaceholder)(group.title) || group.title }));
115
+ const disposable = addElement(this.settingsGroups, group);
126
116
  this.fireDidSettingsChange();
127
117
  return disposable;
128
118
  }
@@ -140,21 +130,6 @@ let PreferenceSettingsService = PreferenceSettingsService_1 = class PreferenceSe
140
130
  this.fireDidSettingsChange();
141
131
  return disposable;
142
132
  }
143
- visitSection(section, cb) {
144
- if (section.preferences) {
145
- for (const preference of section.preferences) {
146
- const result = cb(preference);
147
- if (result) {
148
- return preference;
149
- }
150
- }
151
- }
152
- if (section.subSections && Array.isArray(section.subSections)) {
153
- for (const subSec of section.subSections) {
154
- return this.visitSection(subSec, cb);
155
- }
156
- }
157
- }
158
133
  /**
159
134
  * 通过配置项ID获取配置项展示信息
160
135
  * @param preferenceId 配置项ID
@@ -163,13 +138,13 @@ let PreferenceSettingsService = PreferenceSettingsService_1 = class PreferenceSe
163
138
  const groups = this.settingsSections.values();
164
139
  for (const sections of groups) {
165
140
  for (const section of sections) {
166
- return this.visitSection(section, (preference) => {
141
+ for (const preference of section.preferences) {
167
142
  if (!(0, ide_core_browser_1.isString)(preference)) {
168
143
  if (preference.id === preferenceId) {
169
- return true;
144
+ return preference;
170
145
  }
171
146
  }
172
- });
147
+ }
173
148
  }
174
149
  }
175
150
  }
@@ -179,7 +154,7 @@ let PreferenceSettingsService = PreferenceSettingsService_1 = class PreferenceSe
179
154
  * @param scope 作用域
180
155
  * @param search 搜索条件
181
156
  */
182
- getResolvedSections(groupId, scope, search) {
157
+ getSections(groupId, scope, search) {
183
158
  const key = [groupId, scope, search || ''].join('-');
184
159
  if (this.cachedGroupSection.has(key)) {
185
160
  return this.cachedGroupSection.get(key);
@@ -193,60 +168,29 @@ let PreferenceSettingsService = PreferenceSettingsService_1 = class PreferenceSe
193
168
  }
194
169
  });
195
170
  const result = [];
196
- const processSection = (section) => {
197
- const preferences = section.preferences
198
- .filter((pref) => {
199
- if (this.filterPreferences(pref, scope)) {
200
- return false;
201
- }
202
- return true;
203
- })
204
- .map((pref) => {
205
- const prefId = typeof pref === 'string' ? pref : pref.id;
206
- const schema = this.schemaProvider.getPreferenceProperty(prefId);
207
- const prefLabel = typeof pref === 'string' ? (0, common_1.toPreferenceReadableName)(pref) : (0, common_1.getPreferenceItemLabel)(pref);
208
- const description = schema && (0, ide_core_browser_1.replaceLocalizePlaceholder)(schema.description);
209
- const markdownDescription = schema && (0, ide_core_browser_1.replaceLocalizePlaceholder)(schema.markdownDescription);
210
- return {
211
- id: prefId,
212
- label: prefLabel,
213
- _description: markdownDescription !== null && markdownDescription !== void 0 ? markdownDescription : description,
214
- markdownDescription,
215
- description,
216
- };
217
- })
218
- .filter((pref) => {
219
- if (!search) {
220
- return true;
221
- }
222
- return (this.isContainSearchValue(pref.id, search) ||
223
- this.isContainSearchValue(pref.label, search) ||
224
- (pref.description && this.isContainSearchValue(pref.description, search)) ||
225
- (pref.markdownDescription && this.isContainSearchValue(pref.markdownDescription, search)));
226
- });
227
- return {
228
- preferences,
229
- };
230
- };
231
171
  res.forEach((section) => {
232
- const sec = Object.assign({}, section);
233
172
  if (section.preferences) {
234
- const { preferences } = processSection(section);
235
- sec.preferences = preferences;
236
- }
237
- if (section.subSections) {
238
- const subSections = section.subSections
239
- .map((v) => {
240
- const { preferences } = processSection(v);
241
- if (preferences.length > 0) {
242
- return Object.assign(Object.assign({}, v), { preferences });
173
+ const sec = Object.assign({}, section);
174
+ sec.preferences = section.preferences.filter((pref) => {
175
+ if (this.filterPreferences(pref, scope)) {
176
+ return false;
243
177
  }
244
- })
245
- .filter(Boolean);
246
- sec.subSections = subSections;
247
- }
248
- if ((sec.preferences && sec.preferences.length > 0) || (sec.subSections && sec.subSections.length > 0)) {
249
- result.push(sec);
178
+ if (!search) {
179
+ return true;
180
+ }
181
+ const prefId = typeof pref === 'string' ? pref : pref.id;
182
+ const schema = this.schemaProvider.getPreferenceProperty(prefId);
183
+ const prefLabel = typeof pref === 'string' ? (0, common_1.toPreferenceReadableName)(pref) : (0, common_1.getPreferenceItemLabel)(pref);
184
+ const description = schema && (0, ide_core_browser_1.replaceLocalizePlaceholder)(schema.description);
185
+ const markdownDescription = schema && (0, ide_core_browser_1.replaceLocalizePlaceholder)(schema.markdownDescription);
186
+ return (this.isContainSearchValue(prefId, search) ||
187
+ this.isContainSearchValue(prefLabel, search) ||
188
+ (description && this.isContainSearchValue(description, search)) ||
189
+ (markdownDescription && this.isContainSearchValue(markdownDescription, search)));
190
+ });
191
+ if (sec.preferences.length > 0) {
192
+ result.push(sec);
193
+ }
250
194
  }
251
195
  });
252
196
  this.cachedGroupSection.set(key.toLocaleLowerCase(), result);
@@ -393,11 +337,6 @@ exports.defaultSettingGroup = [
393
337
  title: '%settings.group.editor%',
394
338
  iconClass: (0, ide_core_browser_1.getIcon)('editor'),
395
339
  },
396
- {
397
- id: common_1.PreferenceSettingId.View,
398
- title: '%settings.group.view%',
399
- iconClass: (0, ide_core_browser_1.getIcon)('detail'),
400
- },
401
340
  {
402
341
  id: common_1.PreferenceSettingId.Terminal,
403
342
  title: '%settings.group.terminal%',
@@ -408,24 +347,28 @@ exports.defaultSettingGroup = [
408
347
  title: '%settings.group.feature%',
409
348
  iconClass: (0, ide_core_browser_1.getIcon)('file-text'),
410
349
  },
350
+ {
351
+ id: common_1.PreferenceSettingId.View,
352
+ title: '%settings.group.view%',
353
+ iconClass: (0, ide_core_browser_1.getIcon)('detail'),
354
+ },
411
355
  ];
412
356
  exports.defaultSettingSections = {
413
- [common_1.PreferenceSettingId.General]: [
357
+ general: [
414
358
  {
415
359
  preferences: [
416
- { id: 'general.theme', i18n: 'preference.general.theme' },
417
- { id: 'general.icon', i18n: 'preference.general.icon' },
360
+ { id: 'general.theme', localized: 'preference.general.theme' },
361
+ { id: 'general.icon', localized: 'preference.general.icon' },
418
362
  {
419
363
  id: 'general.language',
420
- i18n: 'preference.general.language',
364
+ localized: 'preference.general.language',
421
365
  hiddenInScope: [ide_core_browser_1.PreferenceScope.Workspace],
422
366
  },
423
367
  ],
424
368
  },
425
369
  ],
426
- [common_1.PreferenceSettingId.Editor]: [
370
+ editor: [
427
371
  {
428
- title: 'Editor',
429
372
  preferences: [
430
373
  // 预览模式
431
374
  { id: 'editor.previewMode' },
@@ -433,21 +376,23 @@ exports.defaultSettingSections = {
433
376
  id: 'editor.enablePreviewFromCodeNavigation',
434
377
  },
435
378
  // 自动保存
436
- { id: 'editor.autoSave', i18n: 'preference.editor.autoSave' },
437
- { id: 'editor.autoSaveDelay', i18n: 'preference.editor.autoSaveDelay' },
379
+ { id: 'editor.autoSave', localized: 'preference.editor.autoSave' },
380
+ { id: 'editor.autoSaveDelay', localized: 'preference.editor.autoSaveDelay' },
438
381
  {
439
382
  id: 'workbench.refactoringChanges.showPreviewStrategy',
440
- i18n: 'preference.workbench.refactoringChanges.showPreviewStrategy.title',
383
+ localized: 'preference.workbench.refactoringChanges.showPreviewStrategy.title',
441
384
  },
442
- { id: 'editor.askIfDiff', i18n: 'preference.editor.askIfDiff' },
385
+ { id: 'editor.askIfDiff', localized: 'preference.editor.askIfDiff' },
443
386
  // 光标样式
444
- { id: 'editor.cursorStyle', i18n: 'preference.editor.cursorStyle' },
387
+ { id: 'editor.cursorStyle', localized: 'preference.editor.cursorStyle' },
445
388
  // 字体
446
- { id: 'editor.fontSize', i18n: 'preference.editor.fontSize' },
447
- { id: 'editor.fontWeight', i18n: 'preference.editor.fontWeight' },
448
- { id: 'editor.fontFamily', i18n: 'preference.editor.fontFamily' },
449
- { id: 'editor.lineHeight', i18n: 'preference.editor.lineHeight' },
389
+ { id: 'editor.fontSize', localized: 'preference.editor.fontSize' },
390
+ { id: 'editor.fontWeight', localized: 'preference.editor.fontWeight' },
391
+ { id: 'editor.fontFamily', localized: 'preference.editor.fontFamily' },
392
+ { id: 'editor.lineHeight', localized: 'preference.editor.lineHeight' },
450
393
  { id: 'editor.trimAutoWhitespace' },
394
+ // workbench
395
+ { id: 'workbench.editorAssociations' },
451
396
  // 补全
452
397
  { id: 'editor.suggest.insertMode' },
453
398
  { id: 'editor.suggest.filterGraceful' },
@@ -487,102 +432,104 @@ exports.defaultSettingSections = {
487
432
  { id: 'editor.suggest.preview' },
488
433
  { id: 'editor.suggest.details.visible' },
489
434
  // Guides
490
- { id: 'editor.guides.bracketPairs', i18n: 'preference.editor.guides.bracketPairs' },
491
- { id: 'editor.guides.indentation', i18n: 'preference.editor.guides.indentation' },
435
+ { id: 'editor.guides.bracketPairs', localized: 'preference.editor.guides.bracketPairs' },
436
+ { id: 'editor.guides.indentation', localized: 'preference.editor.guides.indentation' },
492
437
  {
493
438
  id: 'editor.guides.highlightActiveIndentation',
494
- i18n: 'preference.editor.guides.highlightActiveIndentation',
439
+ localized: 'preference.editor.guides.highlightActiveIndentation',
495
440
  },
496
441
  // 行内补全
497
- { id: 'editor.inlineSuggest.enabled', i18n: 'preference.editor.inlineSuggest.enabled' },
442
+ { id: 'editor.inlineSuggest.enabled', localized: 'preference.editor.inlineSuggest.enabled' },
498
443
  {
499
444
  id: 'editor.experimental.stickyScroll.enabled',
500
- i18n: 'preference.editor.experimental.stickyScroll.enabled',
445
+ localized: 'preference.editor.experimental.stickyScroll.enabled',
501
446
  },
502
447
  // 缩进
503
- { id: 'editor.detectIndentation', i18n: 'preference.editor.detectIndentation' },
504
- { id: 'editor.tabSize', i18n: 'preference.editor.tabSize' },
505
- { id: 'editor.insertSpaces', i18n: 'preference.editor.insertSpace' },
448
+ { id: 'editor.detectIndentation', localized: 'preference.editor.detectIndentation' },
449
+ { id: 'editor.tabSize', localized: 'preference.editor.tabSize' },
450
+ { id: 'editor.insertSpaces', localized: 'preference.editor.insertSpace' },
506
451
  // 显示
507
- { id: 'editor.wrapTab', i18n: 'preference.editor.wrapTab' },
508
- { id: 'editor.wordWrap', i18n: 'preference.editor.wordWrap' },
509
- { id: 'editor.renderLineHighlight', i18n: 'preference.editor.renderLineHighlight' },
510
- { id: 'editor.renderWhitespace', i18n: 'preference.editor.renderWhitespace' },
511
- { id: 'editor.minimap', i18n: 'preference.editor.minimap' },
452
+ { id: 'editor.wrapTab', localized: 'preference.editor.wrapTab' },
453
+ { id: 'editor.wordWrap', localized: 'preference.editor.wordWrap' },
454
+ { id: 'editor.renderLineHighlight', localized: 'preference.editor.renderLineHighlight' },
455
+ { id: 'editor.renderWhitespace', localized: 'preference.editor.renderWhitespace' },
456
+ { id: 'editor.minimap', localized: 'preference.editor.minimap' },
512
457
  // 格式化
513
- { id: 'editor.preferredFormatter', i18n: 'preference.editor.preferredFormatter' },
514
- { id: 'editor.formatOnSave', i18n: 'preference.editor.formatOnSave' },
515
- { id: 'editor.formatOnSaveTimeout', i18n: 'preference.editor.formatOnSaveTimeout' },
516
- { id: 'editor.formatOnPaste', i18n: 'preference.editor.formatOnPaste' },
458
+ { id: 'editor.preferredFormatter', localized: 'preference.editor.preferredFormatter' },
459
+ { id: 'editor.formatOnSave', localized: 'preference.editor.formatOnSave' },
460
+ { id: 'editor.formatOnSaveTimeout', localized: 'preference.editor.formatOnSaveTimeout' },
461
+ { id: 'editor.formatOnPaste', localized: 'preference.editor.formatOnPaste' },
517
462
  // 智能提示
518
- { id: 'editor.quickSuggestionsDelay', i18n: 'preference.editor.quickSuggestionsDelay' },
463
+ { id: 'editor.quickSuggestionsDelay', localized: 'preference.editor.quickSuggestionsDelay' },
519
464
  // 文件
520
465
  // `forceReadOnly` 选项暂时不对用户暴露
521
466
  // {id: 'editor.forceReadOnly', localized: 'preference.editor.forceReadOnly'},
522
- { id: 'editor.maxTokenizationLineLength', i18n: 'preference.editor.maxTokenizationLineLength' },
523
- { id: 'editor.largeFile', i18n: 'preference.editor.largeFile' },
524
- { id: 'editor.readonlyFiles', i18n: 'preference.editor.readonlyFiles' },
467
+ { id: 'editor.maxTokenizationLineLength', localized: 'preference.editor.maxTokenizationLineLength' },
468
+ { id: 'editor.largeFile', localized: 'preference.editor.largeFile' },
469
+ { id: 'editor.readonlyFiles', localized: 'preference.editor.readonlyFiles' },
525
470
  {
526
471
  id: 'editor.bracketPairColorization.enabled',
527
- i18n: 'preference.editor.bracketPairColorization.enabled',
472
+ localized: 'preference.editor.bracketPairColorization.enabled',
528
473
  },
529
- { id: 'workbench.editorAssociations' },
530
- ],
531
- },
532
- {
533
- title: 'Diff Editor',
534
- preferences: [
535
474
  // Diff 编辑器
536
- { id: 'diffEditor.renderSideBySide', i18n: 'preference.diffEditor.renderSideBySide' },
537
- { id: 'diffEditor.ignoreTrimWhitespace', i18n: 'preference.diffEditor.ignoreTrimWhitespace' },
538
- ],
539
- },
540
- {
541
- title: 'Files',
542
- preferences: [
543
- { id: 'files.autoGuessEncoding', i18n: 'preference.files.autoGuessEncoding.title' },
544
- { id: 'files.encoding', i18n: 'preference.files.encoding.title' },
475
+ { id: 'diffEditor.renderSideBySide', localized: 'preference.diffEditor.renderSideBySide' },
476
+ { id: 'diffEditor.ignoreTrimWhitespace', localized: 'preference.diffEditor.ignoreTrimWhitespace' },
477
+ { id: 'files.autoGuessEncoding', localized: 'preference.files.autoGuessEncoding.title' },
478
+ { id: 'files.encoding', localized: 'preference.files.encoding.title' },
545
479
  { id: 'files.eol' },
546
480
  { id: 'files.trimFinalNewlines' },
547
481
  { id: 'files.trimTrailingWhitespace' },
548
482
  { id: 'files.insertFinalNewline' },
549
- { id: 'files.exclude', i18n: 'preference.files.exclude.title' },
550
- { id: 'files.watcherExclude', i18n: 'preference.files.watcherExclude.title' },
551
- { id: 'files.associations', i18n: 'preference.files.associations.title' },
483
+ { id: 'files.exclude', localized: 'preference.files.exclude.title' },
484
+ { id: 'files.watcherExclude', localized: 'preference.files.watcherExclude.title' },
485
+ { id: 'files.associations', localized: 'preference.files.associations.title' },
552
486
  ],
553
487
  },
554
488
  ],
555
- // 整体布局相关的,比如 QuickOpen 也放这
556
- [common_1.PreferenceSettingId.View]: [
489
+ terminal: [
557
490
  {
558
- // 布局信息
559
- title: 'Layout',
560
- preferences: [{ id: 'view.saveLayoutWithWorkspace', i18n: 'preference.view.saveLayoutWithWorkspace.title' }],
561
- },
562
- {
563
- title: 'File Tree',
564
- preferences: [],
565
- },
566
- {
567
- // 资源管理器
568
- title: 'Explorer',
569
491
  preferences: [
570
- { id: 'explorer.fileTree.baseIndent', i18n: 'preference.explorer.fileTree.baseIndent.title' },
571
- { id: 'explorer.fileTree.indent', i18n: 'preference.explorer.fileTree.indent.title' },
572
- { id: 'explorer.compactFolders', i18n: 'preference.explorer.compactFolders.title' },
573
- { id: 'explorer.autoReveal', i18n: 'preference.explorer.autoReveal' },
492
+ // 终端类型
493
+ { id: "terminal.type" /* Type */, localized: 'preference.terminal.type' },
494
+ // 字体
495
+ { id: "terminal.fontFamily" /* FontFamily */, localized: 'preference.terminal.fontFamily' },
496
+ { id: "terminal.fontSize" /* FontSize */, localized: 'preference.terminal.fontSize' },
497
+ { id: "terminal.fontWeight" /* FontWeight */, localized: 'preference.terminal.fontWeight' },
498
+ { id: "terminal.lineHeight" /* LineHeight */, localized: 'preference.terminal.lineHeight' },
499
+ // 光标
500
+ { id: "terminal.cursorBlink" /* CursorBlink */, localized: 'preference.terminal.cursorBlink' },
501
+ // 显示
502
+ { id: "terminal.scrollback" /* Scrollback */, localized: 'preference.terminal.scrollback' },
503
+ // 命令行参数
504
+ { id: 'terminal.integrated.shellArgs.linux', localized: 'preference.terminal.integrated.shellArgs.linux' },
505
+ { id: 'terminal.integrated.copyOnSelection', localized: 'preference.terminal.integrated.copyOnSelection' },
506
+ // Local echo
507
+ { id: 'terminal.integrated.localEchoEnabled', localized: 'preference.terminal.integrated.localEchoEnabled' },
508
+ {
509
+ id: 'terminal.integrated.localEchoLatencyThreshold',
510
+ localized: 'preference.terminal.integrated.localEchoLatencyThreshold',
511
+ },
512
+ {
513
+ id: 'terminal.integrated.localEchoExcludePrograms',
514
+ localized: 'preference.terminal.integrated.localEchoExcludePrograms',
515
+ },
516
+ {
517
+ id: 'terminal.integrated.cursorStyle',
518
+ localized: 'preference.terminal.integrated.cursorStyle',
519
+ },
520
+ { id: 'terminal.integrated.localEchoStyle', localized: 'preference.terminal.integrated.localEchoStyle' },
574
521
  ],
575
522
  },
523
+ ],
524
+ feature: [
576
525
  {
577
- title: 'QuickOpen',
578
- preferences: [{ id: 'workbench.quickOpen.preserveInput' }],
579
- },
580
- {
581
- title: 'Search',
582
526
  preferences: [
527
+ // 树/列表项
528
+ { id: 'workbench.list.openMode', localized: 'preference.workbench.list.openMode.title' },
529
+ { id: 'explorer.autoReveal', localized: 'preference.explorer.autoReveal' },
583
530
  // 搜索
584
531
  { id: "search.include" /* Include */ },
585
- { id: "search.exclude" /* Exclude */, i18n: 'preference.search.exclude.title' },
532
+ { id: "search.exclude" /* Exclude */, localized: 'preference.search.exclude.title' },
586
533
  { id: "search.useReplacePreview" /* UseReplacePreview */ },
587
534
  // { id: 'search.maxResults' },
588
535
  { id: "search.searchOnType" /* SearchOnType */ },
@@ -594,74 +541,31 @@ exports.defaultSettingSections = {
594
541
  // { id: 'search.useParentIgnoreFiles' },
595
542
  // { id: 'search.quickOpen.includeHistory' },
596
543
  // { id: 'search.quickOpen.includeSymbols' },
597
- ],
598
- },
599
- {
600
- title: 'Output',
601
- preferences: [
602
544
  // 输出
603
- { id: 'output.maxChannelLine', i18n: 'output.maxChannelLine' },
604
- { id: 'output.enableLogHighlight', i18n: 'output.enableLogHighlight' },
605
- { id: 'output.enableSmartScroll', i18n: 'output.enableSmartScroll' },
606
- ],
607
- },
608
- {
609
- title: 'Debug',
610
- preferences: [
545
+ { id: 'output.maxChannelLine', localized: 'output.maxChannelLine' },
546
+ { id: 'output.enableLogHighlight', localized: 'output.enableLogHighlight' },
547
+ { id: 'output.enableSmartScroll', localized: 'output.enableSmartScroll' },
611
548
  // 调试
612
549
  // 由于筛选器的匹配模式搜索存在性能、匹配难度大等问题,先暂时隐藏
613
550
  // { id: 'debug.console.filter.mode', localized: 'preference.debug.console.filter.mode' },
614
- { id: 'debug.console.wordWrap', i18n: 'preference.debug.console.wordWrap' },
615
- { id: 'debug.inline.values', i18n: 'preference.debug.inline.values' },
616
- { id: 'debug.toolbar.float', i18n: 'preference.debug.toolbar.float.title' },
551
+ { id: 'debug.console.wordWrap', localized: 'preference.debug.console.wordWrap' },
552
+ { id: 'debug.inline.values', localized: 'preference.debug.inline.values' },
617
553
  ],
618
554
  },
619
555
  ],
620
- [common_1.PreferenceSettingId.Terminal]: [
556
+ view: [
621
557
  {
622
558
  preferences: [
623
- // 终端类型
624
- { id: "terminal.type" /* Type */, i18n: 'preference.terminal.type' },
625
- // 字体
626
- { id: "terminal.fontFamily" /* FontFamily */, i18n: 'preference.terminal.fontFamily' },
627
- { id: "terminal.fontSize" /* FontSize */, i18n: 'preference.terminal.fontSize' },
628
- { id: "terminal.fontWeight" /* FontWeight */, i18n: 'preference.terminal.fontWeight' },
629
- { id: "terminal.lineHeight" /* LineHeight */, i18n: 'preference.terminal.lineHeight' },
630
- // 光标
631
- { id: "terminal.cursorBlink" /* CursorBlink */, i18n: 'preference.terminal.cursorBlink' },
632
- // 显示
633
- { id: "terminal.scrollback" /* Scrollback */, i18n: 'preference.terminal.scrollback' },
634
- // 命令行参数
635
- { id: 'terminal.integrated.shellArgs.linux', i18n: 'preference.terminal.integrated.shellArgs.linux' },
636
- { id: 'terminal.integrated.copyOnSelection', i18n: 'preference.terminal.integrated.copyOnSelection' },
637
- // Local echo
638
- { id: 'terminal.integrated.localEchoEnabled', i18n: 'preference.terminal.integrated.localEchoEnabled' },
639
- {
640
- id: 'terminal.integrated.localEchoLatencyThreshold',
641
- i18n: 'preference.terminal.integrated.localEchoLatencyThreshold',
642
- },
643
- {
644
- id: 'terminal.integrated.localEchoExcludePrograms',
645
- i18n: 'preference.terminal.integrated.localEchoExcludePrograms',
646
- },
647
- {
648
- id: 'terminal.integrated.cursorStyle',
649
- i18n: 'preference.terminal.integrated.cursorStyle',
650
- },
651
- { id: 'terminal.integrated.localEchoStyle', i18n: 'preference.terminal.integrated.localEchoStyle' },
559
+ // 资源管理器
560
+ { id: 'explorer.fileTree.baseIndent', localized: 'preference.explorer.fileTree.baseIndent.title' },
561
+ { id: 'explorer.fileTree.indent', localized: 'preference.explorer.fileTree.indent.title' },
562
+ { id: 'explorer.compactFolders', localized: 'preference.explorer.compactFolders.title' },
563
+ // 运行与调试
564
+ { id: 'debug.toolbar.float', localized: 'preference.debug.toolbar.float.title' },
565
+ // 布局信息
566
+ { id: 'view.saveLayoutWithWorkspace', localized: 'preference.view.saveLayoutWithWorkspace.title' },
652
567
  ],
653
568
  },
654
569
  ],
655
- [common_1.PreferenceSettingId.Feature]: [
656
- {
657
- title: 'Misc',
658
- preferences: [],
659
- },
660
- {
661
- // 树/列表项
662
- title: 'Tree Component',
663
- preferences: [{ id: 'workbench.list.openMode', i18n: 'preference.workbench.list.openMode.title' }],
664
- },
665
- ],
666
570
  };
667
571
  //# sourceMappingURL=preference-settings.service.js.map