@theia/editor 1.30.0-next.7 → 1.30.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.
@@ -1,19 +1,17 @@
1
1
  import { CancellationToken } from '@theia/core/lib/common';
2
- import URI from '@theia/core/lib/common/uri';
3
2
  import { LabelProvider } from '@theia/core/lib/browser/label-provider';
4
- import { OpenerService } from '@theia/core/lib/browser/opener-service';
5
3
  import { QuickAccessProvider, QuickAccessRegistry, QuickAccessContribution } from '@theia/core/lib/browser/quick-input/quick-access';
6
4
  import { QuickPickItem, QuickPickSeparator } from '@theia/core/lib/browser/quick-input/quick-input-service';
7
- import { EditorManager } from './editor-manager';
5
+ import { ApplicationShell, NavigatableWidget } from '@theia/core/lib/browser';
8
6
  export declare class QuickEditorService implements QuickAccessContribution, QuickAccessProvider {
9
7
  static PREFIX: string;
10
- protected readonly openerService: OpenerService;
11
8
  protected readonly labelProvider: LabelProvider;
12
9
  protected readonly quickAccessRegistry: QuickAccessRegistry;
13
- protected readonly editorManager: EditorManager;
10
+ protected readonly shell: ApplicationShell;
11
+ protected groupLocalizations: string[];
14
12
  registerQuickAccessProvider(): void;
15
13
  getPicks(filter: string, token: CancellationToken): (QuickPickItem | QuickPickSeparator)[];
16
- protected toItem(uri: URI): QuickPickItem;
17
- protected openFile(uri: URI): void;
14
+ protected getGroupLocalization(index: number): string;
15
+ protected toItem(widget: NavigatableWidget): QuickPickItem;
18
16
  }
19
17
  //# sourceMappingURL=quick-editor-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quick-editor-service.d.ts","sourceRoot":"","sources":["../../src/browser/quick-editor-service.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,GAAG,MAAM,4BAA4B,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAw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AE,mBAAmB;IACnF,MAAM,CAAC,MAAM,SAAU;IAEA,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IAC1C,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAC/D,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IAErE,SAAS,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAM;IAE5C,2BAA2B,IAAI,IAAI;IASnC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,CAAC,aAAa,GAAG,kBAAkB,CAAC,EAAE;IAiC1F,SAAS,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAIrD,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,aAAa;CAc7D"}
@@ -27,12 +27,15 @@ var QuickEditorService_1;
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
28
  exports.QuickEditorService = void 0;
29
29
  const inversify_1 = require("@theia/core/shared/inversify");
30
+ const common_1 = require("@theia/core/lib/common");
30
31
  const label_provider_1 = require("@theia/core/lib/browser/label-provider");
31
- const opener_service_1 = require("@theia/core/lib/browser/opener-service");
32
32
  const quick_access_1 = require("@theia/core/lib/browser/quick-input/quick-access");
33
33
  const quick_input_service_1 = require("@theia/core/lib/browser/quick-input/quick-input-service");
34
- const editor_manager_1 = require("./editor-manager");
34
+ const browser_1 = require("@theia/core/lib/browser");
35
35
  let QuickEditorService = QuickEditorService_1 = class QuickEditorService {
36
+ constructor() {
37
+ this.groupLocalizations = [];
38
+ }
36
39
  registerQuickAccessProvider() {
37
40
  this.quickAccessRegistry.registerQuickAccessProvider({
38
41
  getInstance: () => this,
@@ -43,46 +46,51 @@ let QuickEditorService = QuickEditorService_1 = class QuickEditorService {
43
46
  }
44
47
  getPicks(filter, token) {
45
48
  const editorItems = [];
46
- // Get the alphabetically sorted list of URIs of all currently opened editor widgets.
47
- const widgets = this.editorManager.all
48
- .map((w) => w.editor.uri)
49
- .sort();
50
- if (widgets.length === 0) {
51
- editorItems.push(({
52
- label: 'List of opened editors is currently empty'
53
- }));
54
- }
55
- else {
56
- for (const uri of widgets) {
57
- const item = this.toItem(uri);
58
- editorItems.push(item);
49
+ const hasUri = (widget) => Boolean(browser_1.NavigatableWidget.getUri(widget));
50
+ const handleWidgets = (widgets, label) => {
51
+ if (widgets.length) {
52
+ editorItems.push({ type: 'separator', label });
59
53
  }
54
+ editorItems.push(...widgets.map(widget => this.toItem(widget)));
55
+ };
56
+ const handleSplittableArea = (tabbars, labelPrefix) => {
57
+ tabbars.forEach((tabbar, index) => {
58
+ const editorsOnTabbar = tabbar.titles.reduce((widgets, title) => {
59
+ if (hasUri(title.owner)) {
60
+ widgets.push(title.owner);
61
+ }
62
+ return widgets;
63
+ }, []);
64
+ const label = tabbars.length > 1 ? `${labelPrefix} ${this.getGroupLocalization(index)}` : labelPrefix;
65
+ handleWidgets(editorsOnTabbar, label);
66
+ });
67
+ };
68
+ handleSplittableArea(this.shell.mainAreaTabBars, browser_1.ApplicationShell.areaLabels.main);
69
+ handleSplittableArea(this.shell.bottomAreaTabBars, browser_1.ApplicationShell.areaLabels.bottom);
70
+ for (const area of ['left', 'right']) {
71
+ const editorsInArea = this.shell.getWidgets(area).filter(hasUri);
72
+ handleWidgets(editorsInArea, browser_1.ApplicationShell.areaLabels[area]);
60
73
  }
61
74
  return (0, quick_input_service_1.filterItems)(editorItems.slice(), filter);
62
75
  }
63
- toItem(uri) {
64
- const description = this.labelProvider.getLongName(uri.parent);
76
+ getGroupLocalization(index) {
77
+ return this.groupLocalizations[index] || common_1.nls.localizeByDefault('Group {0}', index + 1);
78
+ }
79
+ toItem(widget) {
80
+ const uri = browser_1.NavigatableWidget.getUri(widget);
65
81
  const icon = this.labelProvider.getIcon(uri);
66
82
  const iconClasses = icon === '' ? undefined : [icon + ' file-icon'];
67
83
  return {
68
84
  label: this.labelProvider.getName(uri),
69
- description: description,
85
+ description: this.labelProvider.getDetails(uri),
70
86
  iconClasses,
71
87
  ariaLabel: uri.path.fsPath(),
72
88
  alwaysShow: true,
73
- execute: () => this.openFile(uri)
89
+ execute: () => this.shell.activateWidget(widget.id),
74
90
  };
75
91
  }
76
- openFile(uri) {
77
- this.openerService.getOpener(uri)
78
- .then(opener => opener.open(uri));
79
- }
80
92
  };
81
93
  QuickEditorService.PREFIX = 'edt ';
82
- __decorate([
83
- (0, inversify_1.inject)(opener_service_1.OpenerService),
84
- __metadata("design:type", Object)
85
- ], QuickEditorService.prototype, "openerService", void 0);
86
94
  __decorate([
87
95
  (0, inversify_1.inject)(label_provider_1.LabelProvider),
88
96
  __metadata("design:type", label_provider_1.LabelProvider)
@@ -92,9 +100,9 @@ __decorate([
92
100
  __metadata("design:type", Object)
93
101
  ], QuickEditorService.prototype, "quickAccessRegistry", void 0);
94
102
  __decorate([
95
- (0, inversify_1.inject)(editor_manager_1.EditorManager),
96
- __metadata("design:type", editor_manager_1.EditorManager)
97
- ], QuickEditorService.prototype, "editorManager", void 0);
103
+ (0, inversify_1.inject)(browser_1.ApplicationShell),
104
+ __metadata("design:type", browser_1.ApplicationShell)
105
+ ], QuickEditorService.prototype, "shell", void 0);
98
106
  QuickEditorService = QuickEditorService_1 = __decorate([
99
107
  (0, inversify_1.injectable)()
100
108
  ], QuickEditorService);
@@ -1 +1 @@
1
- {"version":3,"file":"quick-editor-service.js","sourceRoot":"","sources":["../../src/browser/quick-editor-service.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oEAAoE;AACpE,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;;;;;;;;;;;;;AAEhF,4DAAkE;AAGlE,2EAAuE;AACvE,2EAAuE;AACvE,mFAAq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AG,2BAAiB,CAAC,MAAM,CAAC,MAAM,CAAE,CAAC;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7C,MAAM,WAAW,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,YAAY,CAAC,CAAC;QAEpE,OAAO;YACH,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC;YACtC,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC;YAC/C,WAAW;YACX,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE;YAC5B,UAAU,EAAE,IAAI;YAChB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;SACtD,CAAC;IACN,CAAC;CACJ,CAAA;AApEU,yBAAM,GAAG,MAAM,CAAC;AAEA;IAAtB,IAAA,kBAAM,EAAC,8BAAa,CAAC;8BAAmC,8BAAa;yDAAC;AAC1C;IAA5B,IAAA,kBAAM,EAAC,kCAAmB,CAAC;;+DAA6D;AAC/D;IAAzB,IAAA,kBAAM,EAAC,0BAAgB,CAAC;8BAA2B,0BAAgB;iDAAC;AAL5D,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;GACA,kBAAkB,CAqE9B;AArEY,gDAAkB"}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@theia/editor",
3
- "version": "1.30.0-next.7+98a0bf6944d",
3
+ "version": "1.30.0",
4
4
  "description": "Theia - Editor Extension",
5
5
  "dependencies": {
6
- "@theia/core": "1.30.0-next.7+98a0bf6944d",
7
- "@theia/variable-resolver": "1.30.0-next.7+98a0bf6944d"
6
+ "@theia/core": "1.30.0",
7
+ "@theia/variable-resolver": "1.30.0"
8
8
  },
9
9
  "publishConfig": {
10
10
  "access": "public"
@@ -39,10 +39,10 @@
39
39
  "watch": "theiaext watch"
40
40
  },
41
41
  "devDependencies": {
42
- "@theia/ext-scripts": "1.29.0"
42
+ "@theia/ext-scripts": "1.30.0"
43
43
  },
44
44
  "nyc": {
45
45
  "extends": "../../configs/nyc.json"
46
46
  },
47
- "gitHead": "98a0bf6944d8ef0cfa3cef52b1c1cb35b4eea063"
47
+ "gitHead": "1b32ca5626bb8252143b7a6ad6b513410f49366e"
48
48
  }
@@ -15,30 +15,21 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { injectable, inject } from '@theia/core/shared/inversify';
18
- import { CancellationToken } from '@theia/core/lib/common';
19
- import URI from '@theia/core/lib/common/uri';
18
+ import { CancellationToken, nls, QuickPickItemOrSeparator } from '@theia/core/lib/common';
20
19
  import { LabelProvider } from '@theia/core/lib/browser/label-provider';
21
- import { OpenerService } from '@theia/core/lib/browser/opener-service';
22
20
  import { QuickAccessProvider, QuickAccessRegistry, QuickAccessContribution } from '@theia/core/lib/browser/quick-input/quick-access';
23
21
  import { filterItems, QuickPickItem, QuickPickSeparator } from '@theia/core/lib/browser/quick-input/quick-input-service';
24
- import { EditorManager } from './editor-manager';
25
- import { EditorWidget } from './editor-widget';
22
+ import { ApplicationShell, NavigatableWidget, TabBar, Widget } from '@theia/core/lib/browser';
26
23
 
27
24
  @injectable()
28
25
  export class QuickEditorService implements QuickAccessContribution, QuickAccessProvider {
29
26
  static PREFIX = 'edt ';
30
27
 
31
- @inject(OpenerService)
32
- protected readonly openerService: OpenerService;
28
+ @inject(LabelProvider) protected readonly labelProvider: LabelProvider;
29
+ @inject(QuickAccessRegistry) protected readonly quickAccessRegistry: QuickAccessRegistry;
30
+ @inject(ApplicationShell) protected readonly shell: ApplicationShell;
33
31
 
34
- @inject(LabelProvider)
35
- protected readonly labelProvider: LabelProvider;
36
-
37
- @inject(QuickAccessRegistry)
38
- protected readonly quickAccessRegistry: QuickAccessRegistry;
39
-
40
- @inject(EditorManager)
41
- protected readonly editorManager: EditorManager;
32
+ protected groupLocalizations: string[] = [];
42
33
 
43
34
  registerQuickAccessProvider(): void {
44
35
  this.quickAccessRegistry.registerQuickAccessProvider({
@@ -50,44 +41,54 @@ export class QuickEditorService implements QuickAccessContribution, QuickAccessP
50
41
  }
51
42
 
52
43
  getPicks(filter: string, token: CancellationToken): (QuickPickItem | QuickPickSeparator)[] {
53
- const editorItems: QuickPickItem[] = [];
44
+ const editorItems: QuickPickItemOrSeparator[] = [];
45
+ const hasUri = (widget: Widget): widget is NavigatableWidget => Boolean(NavigatableWidget.getUri(widget));
46
+ const handleWidgets = (widgets: NavigatableWidget[], label: string) => {
47
+ if (widgets.length) {
48
+ editorItems.push({ type: 'separator', label });
49
+ }
50
+ editorItems.push(...widgets.map(widget => this.toItem(widget)));
51
+ };
52
+ const handleSplittableArea = (tabbars: TabBar<Widget>[], labelPrefix: string) => {
53
+ tabbars.forEach((tabbar, index) => {
54
+ const editorsOnTabbar = tabbar.titles.reduce<NavigatableWidget[]>((widgets, title) => {
55
+ if (hasUri(title.owner)) {
56
+ widgets.push(title.owner);
57
+ }
58
+ return widgets;
59
+ }, []);
60
+ const label = tabbars.length > 1 ? `${labelPrefix} ${this.getGroupLocalization(index)}` : labelPrefix;
61
+ handleWidgets(editorsOnTabbar, label);
62
+ });
63
+ };
54
64
 
55
- // Get the alphabetically sorted list of URIs of all currently opened editor widgets.
56
- const widgets: URI[] = this.editorManager.all
57
- .map((w: EditorWidget) => w.editor.uri)
58
- .sort();
65
+ handleSplittableArea(this.shell.mainAreaTabBars, ApplicationShell.areaLabels.main);
66
+ handleSplittableArea(this.shell.bottomAreaTabBars, ApplicationShell.areaLabels.bottom);
59
67
 
60
- if (widgets.length === 0) {
61
- editorItems.push(({
62
- label: 'List of opened editors is currently empty'
63
- }));
64
- } else {
65
- for (const uri of widgets) {
66
- const item = this.toItem(uri);
67
- editorItems.push(item);
68
- }
68
+ for (const area of ['left', 'right'] as ApplicationShell.Area[]) {
69
+ const editorsInArea = this.shell.getWidgets(area).filter(hasUri);
70
+ handleWidgets(editorsInArea, ApplicationShell.areaLabels[area]);
69
71
  }
70
72
 
71
73
  return filterItems(editorItems.slice(), filter);
72
74
  }
73
75
 
74
- protected toItem(uri: URI): QuickPickItem {
75
- const description = this.labelProvider.getLongName(uri.parent);
76
+ protected getGroupLocalization(index: number): string {
77
+ return this.groupLocalizations[index] || nls.localizeByDefault('Group {0}', index + 1);
78
+ }
79
+
80
+ protected toItem(widget: NavigatableWidget): QuickPickItem {
81
+ const uri = NavigatableWidget.getUri(widget)!;
76
82
  const icon = this.labelProvider.getIcon(uri);
77
83
  const iconClasses = icon === '' ? undefined : [icon + ' file-icon'];
78
84
 
79
85
  return {
80
86
  label: this.labelProvider.getName(uri),
81
- description: description,
87
+ description: this.labelProvider.getDetails(uri),
82
88
  iconClasses,
83
89
  ariaLabel: uri.path.fsPath(),
84
90
  alwaysShow: true,
85
- execute: () => this.openFile(uri)
91
+ execute: () => this.shell.activateWidget(widget.id),
86
92
  };
87
93
  }
88
-
89
- protected openFile(uri: URI): void {
90
- this.openerService.getOpener(uri)
91
- .then(opener => opener.open(uri));
92
- }
93
94
  }