@theia/core 1.53.0-next.6 → 1.53.1
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.
- package/README.md +7 -7
- package/i18n/nls.cs.json +30 -0
- package/i18n/nls.de.json +30 -0
- package/i18n/nls.es.json +30 -0
- package/i18n/nls.fr.json +30 -0
- package/i18n/nls.hu.json +30 -0
- package/i18n/nls.it.json +30 -0
- package/i18n/nls.ja.json +30 -0
- package/i18n/nls.json +31 -1
- package/i18n/nls.ko.json +582 -0
- package/i18n/nls.pl.json +30 -0
- package/i18n/nls.pt-br.json +30 -0
- package/i18n/nls.ru.json +30 -0
- package/i18n/nls.tr.json +582 -0
- package/i18n/nls.zh-cn.json +30 -0
- package/i18n/nls.zh-tw.json +582 -0
- package/lib/browser/catalog.json +6824 -0
- package/lib/browser/context-key-service.d.ts +3 -2
- package/lib/browser/context-key-service.d.ts.map +1 -1
- package/lib/browser/context-key-service.js.map +1 -1
- package/lib/browser/frontend-application-module.d.ts.map +1 -1
- package/lib/browser/frontend-application-module.js.map +1 -1
- package/lib/browser/json-schema-store.d.ts +0 -3
- package/lib/browser/json-schema-store.d.ts.map +1 -1
- package/lib/browser/json-schema-store.js +2 -12
- package/lib/browser/json-schema-store.js.map +1 -1
- package/lib/browser/opener-service.d.ts +5 -0
- package/lib/browser/opener-service.d.ts.map +1 -1
- package/lib/browser/opener-service.js +5 -2
- package/lib/browser/opener-service.js.map +1 -1
- package/lib/browser/saveable-service.d.ts.map +1 -1
- package/lib/browser/saveable-service.js +6 -2
- package/lib/browser/saveable-service.js.map +1 -1
- package/lib/browser/saveable.d.ts +17 -1
- package/lib/browser/saveable.d.ts.map +1 -1
- package/lib/browser/saveable.js +62 -1
- package/lib/browser/saveable.js.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.d.ts +2 -2
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.d.ts.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.js.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.d.ts +6 -16
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.d.ts.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.js +11 -29
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.js.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.d.ts +39 -78
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.d.ts.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.js +8 -39
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.js.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.d.ts +10 -10
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.d.ts.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.js +43 -32
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.js.map +1 -1
- package/lib/browser/view-container.d.ts +2 -2
- package/lib/browser/view-container.d.ts.map +1 -1
- package/lib/browser/view-container.js.map +1 -1
- package/lib/browser/widget-open-handler.d.ts +4 -1
- package/lib/browser/widget-open-handler.d.ts.map +1 -1
- package/lib/browser/widget-open-handler.js.map +1 -1
- package/lib/browser/widgets/index.d.ts +1 -0
- package/lib/browser/widgets/index.d.ts.map +1 -1
- package/lib/browser/widgets/index.js +1 -0
- package/lib/browser/widgets/index.js.map +1 -1
- package/lib/browser/widgets/split-widget.d.ts +45 -0
- package/lib/browser/widgets/split-widget.d.ts.map +1 -0
- package/lib/browser/widgets/split-widget.js +126 -0
- package/lib/browser/widgets/split-widget.js.map +1 -0
- package/lib/common/event.d.ts +2 -0
- package/lib/common/event.d.ts.map +1 -1
- package/lib/common/event.js +4 -0
- package/lib/common/event.js.map +1 -1
- package/lib/common/json-schema.d.ts +2 -0
- package/lib/common/json-schema.d.ts.map +1 -1
- package/lib/common/menu/menu-types.d.ts.map +1 -1
- package/lib/common/menu/menu-types.js.map +1 -1
- package/lib/electron-browser/electron-uri-handler.d.ts +6 -0
- package/lib/electron-browser/electron-uri-handler.d.ts.map +1 -0
- package/lib/electron-browser/electron-uri-handler.js +49 -0
- package/lib/electron-browser/electron-uri-handler.js.map +1 -0
- package/lib/electron-browser/menu/electron-main-menu-factory.d.ts +1 -1
- package/lib/electron-browser/menu/electron-main-menu-factory.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-main-menu-factory.js +6 -6
- package/lib/electron-browser/menu/electron-main-menu-factory.js.map +1 -1
- package/lib/electron-browser/preload.d.ts.map +1 -1
- package/lib/electron-browser/preload.js +12 -0
- package/lib/electron-browser/preload.js.map +1 -1
- package/lib/electron-browser/window/electron-window-module.d.ts.map +1 -1
- package/lib/electron-browser/window/electron-window-module.js +3 -0
- package/lib/electron-browser/window/electron-window-module.js.map +1 -1
- package/lib/electron-browser/window/external-app-open-handler.js +1 -1
- package/lib/electron-browser/window/external-app-open-handler.js.map +1 -1
- package/lib/electron-common/electron-api.d.ts +2 -0
- package/lib/electron-common/electron-api.d.ts.map +1 -1
- package/lib/electron-common/electron-api.js +2 -1
- package/lib/electron-common/electron-api.js.map +1 -1
- package/lib/electron-main/electron-api-main.d.ts +2 -0
- package/lib/electron-main/electron-api-main.d.ts.map +1 -1
- package/lib/electron-main/electron-api-main.js +27 -3
- package/lib/electron-main/electron-api-main.js.map +1 -1
- package/lib/electron-main/electron-main-application.d.ts +5 -3
- package/lib/electron-main/electron-main-application.d.ts.map +1 -1
- package/lib/electron-main/electron-main-application.js +57 -14
- package/lib/electron-main/electron-main-application.js.map +1 -1
- package/lib/electron-main/theia-electron-window.d.ts +1 -0
- package/lib/electron-main/theia-electron-window.d.ts.map +1 -1
- package/lib/electron-main/theia-electron-window.js +3 -0
- package/lib/electron-main/theia-electron-window.js.map +1 -1
- package/lib/node/i18n/theia-localization-contribution.d.ts.map +1 -1
- package/lib/node/i18n/theia-localization-contribution.js +12 -8
- package/lib/node/i18n/theia-localization-contribution.js.map +1 -1
- package/package.json +10 -8
- package/src/browser/context-key-service.ts +3 -3
- package/src/browser/frontend-application-module.ts +0 -1
- package/src/browser/json-schema-store.ts +2 -11
- package/src/browser/opener-service.ts +12 -2
- package/src/browser/saveable-service.ts +6 -2
- package/src/browser/saveable.ts +69 -1
- package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-menu-adapters.ts +2 -2
- package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.ts +18 -33
- package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-types.ts +62 -124
- package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.tsx +40 -25
- package/src/browser/style/index.css +1 -0
- package/src/browser/style/split-widget.css +38 -0
- package/src/browser/style/tabs.css +13 -24
- package/src/browser/style/view-container.css +0 -7
- package/src/browser/view-container.ts +2 -2
- package/src/browser/widget-open-handler.ts +4 -1
- package/src/browser/widgets/index.ts +1 -0
- package/src/browser/widgets/split-widget.ts +163 -0
- package/src/common/event.ts +6 -0
- package/src/common/json-schema.ts +2 -0
- package/src/common/menu/menu-types.ts +1 -0
- package/src/electron-browser/electron-uri-handler.ts +42 -0
- package/src/electron-browser/menu/electron-main-menu-factory.ts +7 -6
- package/src/electron-browser/preload.ts +16 -1
- package/src/electron-browser/window/electron-window-module.ts +3 -0
- package/src/electron-browser/window/external-app-open-handler.ts +1 -1
- package/src/electron-common/electron-api.ts +3 -0
- package/src/electron-main/electron-api-main.ts +31 -5
- package/src/electron-main/electron-main-application.ts +62 -20
- package/src/electron-main/theia-electron-window.ts +5 -0
- package/src/node/i18n/theia-localization-contribution.ts +12 -8
- package/i18n/nls.pt-pt.json +0 -552
|
@@ -20,18 +20,22 @@ const tslib_1 = require("tslib");
|
|
|
20
20
|
const inversify_1 = require("inversify");
|
|
21
21
|
let TheiaLocalizationContribution = class TheiaLocalizationContribution {
|
|
22
22
|
async registerLocalizations(registry) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
registry.registerLocalizationFromRequire('
|
|
23
|
+
// Attempt to use the same languages as VS Code
|
|
24
|
+
// See https://code.visualstudio.com/docs/getstarted/locales#_available-locales
|
|
25
|
+
registry.registerLocalizationFromRequire('zh-cn', require('../../../i18n/nls.zh-cn.json'));
|
|
26
|
+
registry.registerLocalizationFromRequire('zh-tw', require('../../../i18n/nls.zh-tw.json'));
|
|
26
27
|
registry.registerLocalizationFromRequire('fr', require('../../../i18n/nls.fr.json'));
|
|
27
|
-
registry.registerLocalizationFromRequire('
|
|
28
|
+
registry.registerLocalizationFromRequire('de', require('../../../i18n/nls.de.json'));
|
|
28
29
|
registry.registerLocalizationFromRequire('it', require('../../../i18n/nls.it.json'));
|
|
30
|
+
registry.registerLocalizationFromRequire('es', require('../../../i18n/nls.es.json'));
|
|
29
31
|
registry.registerLocalizationFromRequire('ja', require('../../../i18n/nls.ja.json'));
|
|
30
|
-
registry.registerLocalizationFromRequire('
|
|
31
|
-
registry.registerLocalizationFromRequire('pt-br', require('../../../i18n/nls.pt-br.json'));
|
|
32
|
-
registry.registerLocalizationFromRequire('pt-pt', require('../../../i18n/nls.pt-pt.json'));
|
|
32
|
+
registry.registerLocalizationFromRequire('ko', require('../../../i18n/nls.ko.json'));
|
|
33
33
|
registry.registerLocalizationFromRequire('ru', require('../../../i18n/nls.ru.json'));
|
|
34
|
-
registry.registerLocalizationFromRequire('
|
|
34
|
+
registry.registerLocalizationFromRequire('pt-br', require('../../../i18n/nls.pt-br.json'));
|
|
35
|
+
registry.registerLocalizationFromRequire('tr', require('../../../i18n/nls.tr.json'));
|
|
36
|
+
registry.registerLocalizationFromRequire('pl', require('../../../i18n/nls.pl.json'));
|
|
37
|
+
registry.registerLocalizationFromRequire('cs', require('../../../i18n/nls.cs.json'));
|
|
38
|
+
registry.registerLocalizationFromRequire('hu', require('../../../i18n/nls.hu.json'));
|
|
35
39
|
}
|
|
36
40
|
};
|
|
37
41
|
exports.TheiaLocalizationContribution = TheiaLocalizationContribution;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theia-localization-contribution.js","sourceRoot":"","sources":["../../../src/node/i18n/theia-localization-contribution.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,yCAAuC;AAIhC,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IACtC,KAAK,CAAC,qBAAqB,CAAC,QAA8B;QACtD,QAAQ,CAAC,+BAA+B,CAAC,
|
|
1
|
+
{"version":3,"file":"theia-localization-contribution.js","sourceRoot":"","sources":["../../../src/node/i18n/theia-localization-contribution.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,yCAAuC;AAIhC,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IACtC,KAAK,CAAC,qBAAqB,CAAC,QAA8B;QACtD,+CAA+C;QAC/C,+EAA+E;QAC/E,QAAQ,CAAC,+BAA+B,CAAC,OAAO,EAAE,OAAO,CAAC,8BAA8B,CAAC,CAAC,CAAC;QAC3F,QAAQ,CAAC,+BAA+B,CAAC,OAAO,EAAE,OAAO,CAAC,8BAA8B,CAAC,CAAC,CAAC;QAC3F,QAAQ,CAAC,+BAA+B,CAAC,IAAI,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACrF,QAAQ,CAAC,+BAA+B,CAAC,IAAI,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACrF,QAAQ,CAAC,+BAA+B,CAAC,IAAI,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACrF,QAAQ,CAAC,+BAA+B,CAAC,IAAI,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACrF,QAAQ,CAAC,+BAA+B,CAAC,IAAI,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACrF,QAAQ,CAAC,+BAA+B,CAAC,IAAI,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACrF,QAAQ,CAAC,+BAA+B,CAAC,IAAI,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACrF,QAAQ,CAAC,+BAA+B,CAAC,OAAO,EAAE,OAAO,CAAC,8BAA8B,CAAC,CAAC,CAAC;QAC3F,QAAQ,CAAC,+BAA+B,CAAC,IAAI,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACrF,QAAQ,CAAC,+BAA+B,CAAC,IAAI,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACrF,QAAQ,CAAC,+BAA+B,CAAC,IAAI,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACrF,QAAQ,CAAC,+BAA+B,CAAC,IAAI,EAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC;IACzF,CAAC;CACJ,CAAA;AAnBY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,sBAAU,GAAE;GACA,6BAA6B,CAmBzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/core",
|
|
3
|
-
"version": "1.53.
|
|
3
|
+
"version": "1.53.1",
|
|
4
4
|
"description": "Theia is a cloud & desktop IDE framework implemented in TypeScript.",
|
|
5
5
|
"main": "lib/common/index.js",
|
|
6
6
|
"typings": "lib/common/index.d.ts",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"@phosphor/signaling": "1",
|
|
17
17
|
"@phosphor/virtualdom": "1",
|
|
18
18
|
"@phosphor/widgets": "1",
|
|
19
|
-
"@theia/application-package": "1.53.
|
|
20
|
-
"@theia/request": "1.53.
|
|
19
|
+
"@theia/application-package": "1.53.1",
|
|
20
|
+
"@theia/request": "1.53.1",
|
|
21
21
|
"@types/body-parser": "^1.16.4",
|
|
22
22
|
"@types/cookie": "^0.3.3",
|
|
23
23
|
"@types/dompurify": "^2.2.2",
|
|
@@ -203,18 +203,20 @@
|
|
|
203
203
|
"generate-layout": "electron ./scripts/generate-layout",
|
|
204
204
|
"generate-theia-re-exports": "theia-re-exports generate && theia-re-exports template README_TEMPLATE.md > README.md",
|
|
205
205
|
"lint": "theiaext lint",
|
|
206
|
-
"prepare": "yarn -s generate-theia-re-exports",
|
|
206
|
+
"prepare": "yarn -s generate-theia-re-exports && yarn download:json-schema",
|
|
207
|
+
"download:json-schema": "node ./scripts/download-catalog.js",
|
|
207
208
|
"test": "theiaext test",
|
|
208
209
|
"version": "yarn -s generate-theia-re-exports",
|
|
209
210
|
"watch": "theiaext watch"
|
|
210
211
|
},
|
|
211
212
|
"devDependencies": {
|
|
212
|
-
"@theia/ext-scripts": "1.
|
|
213
|
-
"@theia/re-exports": "1.
|
|
214
|
-
"minimist": "^1.2.0"
|
|
213
|
+
"@theia/ext-scripts": "1.53.1",
|
|
214
|
+
"@theia/re-exports": "1.53.1",
|
|
215
|
+
"minimist": "^1.2.0",
|
|
216
|
+
"nodejs-file-downloader": "4.13.0"
|
|
215
217
|
},
|
|
216
218
|
"nyc": {
|
|
217
219
|
"extends": "../../configs/nyc.json"
|
|
218
220
|
},
|
|
219
|
-
"gitHead": "
|
|
221
|
+
"gitHead": "e891c9be687dce3645614b7b75ec0dcd4c2057f4"
|
|
220
222
|
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { injectable } from 'inversify';
|
|
18
18
|
import { Emitter, Event } from '../common/event';
|
|
19
|
+
import { Disposable } from '../common';
|
|
19
20
|
|
|
20
21
|
export type ContextKeyValue = null | undefined | boolean | number | string
|
|
21
22
|
| Array<null | undefined | boolean | number | string>
|
|
@@ -83,11 +84,10 @@ export interface ContextKeyService extends ContextMatcher {
|
|
|
83
84
|
setContext(key: string, value: unknown): void;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
export type ScopedValueStore = Omit<ContextKeyService, 'onDidChange' | 'match' | 'parseKeys' | 'with' | 'createOverlay'
|
|
87
|
+
export type ScopedValueStore = Omit<ContextKeyService, 'onDidChange' | 'match' | 'parseKeys' | 'with' | 'createOverlay'> & Disposable;
|
|
87
88
|
|
|
88
89
|
@injectable()
|
|
89
90
|
export class ContextKeyServiceDummyImpl implements ContextKeyService {
|
|
90
|
-
|
|
91
91
|
protected readonly onDidChangeEmitter = new Emitter<ContextKeyChangeEvent>();
|
|
92
92
|
readonly onDidChange = this.onDidChangeEmitter.event;
|
|
93
93
|
protected fireDidChange(event: ContextKeyChangeEvent): void {
|
|
@@ -122,7 +122,7 @@ export class ContextKeyServiceDummyImpl implements ContextKeyService {
|
|
|
122
122
|
/**
|
|
123
123
|
* Details should implemented by an extension, e.g. by the monaco extension.
|
|
124
124
|
*/
|
|
125
|
-
createScoped(target: HTMLElement):
|
|
125
|
+
createScoped(target: HTMLElement): ScopedValueStore {
|
|
126
126
|
return this;
|
|
127
127
|
}
|
|
128
128
|
|
|
@@ -465,7 +465,6 @@ export const frontendApplicationModule = new ContainerModule((bind, _unbind, _is
|
|
|
465
465
|
bind(FrontendApplicationContribution).toService(StylingService);
|
|
466
466
|
|
|
467
467
|
bind(SecondaryWindowHandler).toSelf().inSingletonScope();
|
|
468
|
-
|
|
469
468
|
bind(ViewColumnService).toSelf().inSingletonScope();
|
|
470
469
|
|
|
471
470
|
bind(UndoRedoHandlerService).toSelf().inSingletonScope();
|
|
@@ -18,9 +18,7 @@ import { injectable, inject, named } from 'inversify';
|
|
|
18
18
|
import { ContributionProvider } from '../common/contribution-provider';
|
|
19
19
|
import { FrontendApplicationContribution } from './frontend-application-contribution';
|
|
20
20
|
import { MaybePromise } from '../common';
|
|
21
|
-
import { Endpoint } from './endpoint';
|
|
22
21
|
import { timeout, Deferred } from '../common/promise-util';
|
|
23
|
-
import { RequestContext, RequestService } from '@theia/request';
|
|
24
22
|
|
|
25
23
|
export interface JsonSchemaConfiguration {
|
|
26
24
|
fileMatch: string | string[];
|
|
@@ -95,16 +93,9 @@ export class JsonSchemaStore implements FrontendApplicationContribution {
|
|
|
95
93
|
|
|
96
94
|
@injectable()
|
|
97
95
|
export class DefaultJsonSchemaContribution implements JsonSchemaContribution {
|
|
98
|
-
|
|
99
|
-
@inject(RequestService)
|
|
100
|
-
protected readonly requestService: RequestService;
|
|
101
|
-
|
|
102
|
-
protected readonly jsonSchemaUrl = `${new Endpoint().httpScheme}//schemastore.org/api/json/catalog.json`;
|
|
103
|
-
|
|
104
96
|
async registerSchemas(context: JsonSchemaRegisterContext): Promise<void> {
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
for (const s of schemas) {
|
|
97
|
+
const catalog = require('./catalog.json') as { schemas: DefaultJsonSchemaContribution.SchemaData[] };
|
|
98
|
+
for (const s of catalog.schemas) {
|
|
108
99
|
if (s.fileMatch) {
|
|
109
100
|
context.registerSchema({
|
|
110
101
|
fileMatch: s.fileMatch,
|
|
@@ -79,6 +79,12 @@ export interface OpenerService {
|
|
|
79
79
|
* Add open handler i.e. for custom editors
|
|
80
80
|
*/
|
|
81
81
|
addHandler?(openHandler: OpenHandler): Disposable;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Remove open handler
|
|
85
|
+
*/
|
|
86
|
+
removeHandler?(openHandler: OpenHandler): void;
|
|
87
|
+
|
|
82
88
|
/**
|
|
83
89
|
* Event that fires when a new opener is added or removed.
|
|
84
90
|
*/
|
|
@@ -108,11 +114,15 @@ export class DefaultOpenerService implements OpenerService {
|
|
|
108
114
|
this.onDidChangeOpenersEmitter.fire();
|
|
109
115
|
|
|
110
116
|
return Disposable.create(() => {
|
|
111
|
-
this.
|
|
112
|
-
this.onDidChangeOpenersEmitter.fire();
|
|
117
|
+
this.removeHandler(openHandler);
|
|
113
118
|
});
|
|
114
119
|
}
|
|
115
120
|
|
|
121
|
+
removeHandler(openHandler: OpenHandler): void {
|
|
122
|
+
this.customEditorOpenHandlers.splice(this.customEditorOpenHandlers.indexOf(openHandler), 1);
|
|
123
|
+
this.onDidChangeOpenersEmitter.fire();
|
|
124
|
+
}
|
|
125
|
+
|
|
116
126
|
async getOpener(uri: URI, options?: OpenerOptions): Promise<OpenHandler> {
|
|
117
127
|
const handlers = await this.prioritize(uri, options);
|
|
118
128
|
if (handlers.length >= 1) {
|
|
@@ -174,7 +174,10 @@ export class SaveableService implements FrontendApplicationContribution {
|
|
|
174
174
|
setDirty(saveableWidget, saveable.dirty);
|
|
175
175
|
saveable.onDirtyChanged(() => setDirty(saveableWidget, saveable.dirty));
|
|
176
176
|
const closeWithSaving = this.createCloseWithSaving();
|
|
177
|
-
const closeWithoutSaving = () =>
|
|
177
|
+
const closeWithoutSaving = async () => {
|
|
178
|
+
const revert = Saveable.closingWidgetWouldLoseSaveable(saveableWidget, Array.from(this.saveThrottles.keys()));
|
|
179
|
+
await this.closeWithoutSaving(saveableWidget, revert);
|
|
180
|
+
};
|
|
178
181
|
Object.assign(saveableWidget, {
|
|
179
182
|
closeWithoutSaving,
|
|
180
183
|
closeWithSaving,
|
|
@@ -224,7 +227,8 @@ export class SaveableService implements FrontendApplicationContribution {
|
|
|
224
227
|
}
|
|
225
228
|
const notLastWithDocument = !Saveable.closingWidgetWouldLoseSaveable(widget, Array.from(this.saveThrottles.keys()));
|
|
226
229
|
if (notLastWithDocument) {
|
|
227
|
-
|
|
230
|
+
await widget.closeWithoutSaving(false);
|
|
231
|
+
return undefined;
|
|
228
232
|
}
|
|
229
233
|
if (options && options.shouldSave) {
|
|
230
234
|
return options.shouldSave();
|
package/src/browser/saveable.ts
CHANGED
|
@@ -21,7 +21,7 @@ import { MaybePromise } from '../common/types';
|
|
|
21
21
|
import { Key } from './keyboard/keys';
|
|
22
22
|
import { AbstractDialog } from './dialogs';
|
|
23
23
|
import { nls } from '../common/nls';
|
|
24
|
-
import { DisposableCollection, isObject } from '../common';
|
|
24
|
+
import { Disposable, DisposableCollection, isObject } from '../common';
|
|
25
25
|
import { BinaryBuffer } from '../common/buffer';
|
|
26
26
|
|
|
27
27
|
export type AutoSaveMode = 'off' | 'afterDelay' | 'onFocusChange' | 'onWindowChange';
|
|
@@ -112,6 +112,74 @@ export class DelegatingSaveable implements Saveable {
|
|
|
112
112
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
export class CompositeSaveable implements Saveable {
|
|
116
|
+
protected isDirty = false;
|
|
117
|
+
protected readonly onDirtyChangedEmitter = new Emitter<void>();
|
|
118
|
+
protected readonly onContentChangedEmitter = new Emitter<void>();
|
|
119
|
+
protected readonly toDispose = new DisposableCollection(this.onDirtyChangedEmitter, this.onContentChangedEmitter);
|
|
120
|
+
protected readonly saveablesMap = new Map<Saveable, Disposable>();
|
|
121
|
+
|
|
122
|
+
get dirty(): boolean {
|
|
123
|
+
return this.isDirty;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
get onDirtyChanged(): Event<void> {
|
|
127
|
+
return this.onDirtyChangedEmitter.event;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
get onContentChanged(): Event<void> {
|
|
131
|
+
return this.onContentChangedEmitter.event;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async save(options?: SaveOptions): Promise<void> {
|
|
135
|
+
await Promise.all(this.saveables.map(saveable => saveable.save(options)));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async revert(options?: Saveable.RevertOptions): Promise<void> {
|
|
139
|
+
await Promise.all(this.saveables.map(saveable => saveable.revert?.(options)));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
get saveables(): readonly Saveable[] {
|
|
143
|
+
return Array.from(this.saveablesMap.keys());
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
add(saveable: Saveable): void {
|
|
147
|
+
if (this.saveablesMap.has(saveable)) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const toDispose = new DisposableCollection();
|
|
151
|
+
this.toDispose.push(toDispose);
|
|
152
|
+
this.saveablesMap.set(saveable, toDispose);
|
|
153
|
+
toDispose.push(Disposable.create(() => {
|
|
154
|
+
this.saveablesMap.delete(saveable);
|
|
155
|
+
}));
|
|
156
|
+
toDispose.push(saveable.onDirtyChanged(() => {
|
|
157
|
+
const wasDirty = this.isDirty;
|
|
158
|
+
this.isDirty = this.saveables.some(s => s.dirty);
|
|
159
|
+
if (this.isDirty !== wasDirty) {
|
|
160
|
+
this.onDirtyChangedEmitter.fire();
|
|
161
|
+
}
|
|
162
|
+
}));
|
|
163
|
+
toDispose.push(saveable.onContentChanged(() => {
|
|
164
|
+
this.onContentChangedEmitter.fire();
|
|
165
|
+
}));
|
|
166
|
+
if (saveable.dirty && !this.isDirty) {
|
|
167
|
+
this.isDirty = true;
|
|
168
|
+
this.onDirtyChangedEmitter.fire();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
remove(saveable: Saveable): boolean {
|
|
173
|
+
const toDispose = this.saveablesMap.get(saveable);
|
|
174
|
+
toDispose?.dispose();
|
|
175
|
+
return !!toDispose;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
dispose(): void {
|
|
179
|
+
this.toDispose.dispose();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
115
183
|
export namespace Saveable {
|
|
116
184
|
export interface RevertOptions {
|
|
117
185
|
/**
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { MenuNode, MenuPath } from '../../../common';
|
|
18
|
-
import { NAVIGATION,
|
|
18
|
+
import { NAVIGATION, RenderedToolbarItem } from './tab-bar-toolbar-types';
|
|
19
19
|
|
|
20
20
|
export const TOOLBAR_WRAPPER_ID_SUFFIX = '-as-tabbar-toolbar-item';
|
|
21
21
|
|
|
22
|
-
export class ToolbarMenuNodeWrapper implements
|
|
22
|
+
export class ToolbarMenuNodeWrapper implements RenderedToolbarItem {
|
|
23
23
|
constructor(protected readonly menuNode: MenuNode, readonly group?: string, readonly menuPath?: MenuPath) { }
|
|
24
24
|
get id(): string { return this.menuNode.id + TOOLBAR_WRAPPER_ID_SUFFIX; }
|
|
25
25
|
get command(): string { return this.menuNode.command ?? ''; };
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
import debounce = require('lodash.debounce');
|
|
18
18
|
import { inject, injectable, named } from 'inversify';
|
|
19
19
|
// eslint-disable-next-line max-len
|
|
20
|
-
import {
|
|
20
|
+
import { CommandRegistry, ContributionProvider, Disposable, DisposableCollection, Emitter, Event, MenuModelRegistry, MenuNode, MenuPath } from '../../../common';
|
|
21
21
|
import { ContextKeyService } from '../../context-key-service';
|
|
22
22
|
import { FrontendApplicationContribution } from '../../frontend-application-contribution';
|
|
23
23
|
import { Widget } from '../../widgets';
|
|
24
|
-
import {
|
|
24
|
+
import { MenuDelegate, ReactTabBarToolbarItem, RenderedToolbarItem, TabBarToolbarItem } from './tab-bar-toolbar-types';
|
|
25
25
|
import { ToolbarMenuNodeWrapper } from './tab-bar-toolbar-menu-adapters';
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -75,7 +75,7 @@ export class TabBarToolbarRegistry implements FrontendApplicationContribution {
|
|
|
75
75
|
*
|
|
76
76
|
* @param item the item to register.
|
|
77
77
|
*/
|
|
78
|
-
registerItem(item:
|
|
78
|
+
registerItem(item: RenderedToolbarItem | ReactTabBarToolbarItem): Disposable {
|
|
79
79
|
const { id } = item;
|
|
80
80
|
if (this.items.has(id)) {
|
|
81
81
|
throw new Error(`A toolbar item is already registered with the '${id}' ID.`);
|
|
@@ -110,24 +110,17 @@ export class TabBarToolbarRegistry implements FrontendApplicationContribution {
|
|
|
110
110
|
for (const delegate of this.menuDelegates.values()) {
|
|
111
111
|
if (delegate.isVisible(widget)) {
|
|
112
112
|
const menu = this.menuRegistry.getMenu(delegate.menuPath);
|
|
113
|
-
const
|
|
114
|
-
for (const child of children) {
|
|
113
|
+
for (const child of menu.children) {
|
|
115
114
|
if (!child.when || this.contextKeyService.match(child.when, widget.node)) {
|
|
116
115
|
if (child.children) {
|
|
117
116
|
for (const grandchild of child.children) {
|
|
118
117
|
if (!grandchild.when || this.contextKeyService.match(grandchild.when, widget.node)) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
} else if (CompoundMenuNode.is(grandchild)) {
|
|
122
|
-
let menuPath;
|
|
123
|
-
if (menuPath = this.menuRegistry.getPath(grandchild)) {
|
|
124
|
-
result.push(new ToolbarMenuNodeWrapper(grandchild, child.id, menuPath));
|
|
125
|
-
}
|
|
126
|
-
}
|
|
118
|
+
const menuPath = this.menuRegistry.getPath(grandchild);
|
|
119
|
+
result.push(new ToolbarMenuNodeWrapper(grandchild, child.id, menuPath));
|
|
127
120
|
}
|
|
128
121
|
}
|
|
129
122
|
} else if (child.command) {
|
|
130
|
-
result.push(new ToolbarMenuNodeWrapper(child, ''
|
|
123
|
+
result.push(new ToolbarMenuNodeWrapper(child, ''));
|
|
131
124
|
}
|
|
132
125
|
}
|
|
133
126
|
}
|
|
@@ -145,15 +138,17 @@ export class TabBarToolbarRegistry implements FrontendApplicationContribution {
|
|
|
145
138
|
* @returns `false` if the `item` should be suppressed, otherwise `true`
|
|
146
139
|
*/
|
|
147
140
|
protected isItemVisible(item: TabBarToolbarItem | ReactTabBarToolbarItem, widget: Widget): boolean {
|
|
148
|
-
if (
|
|
141
|
+
if (!this.isConditionalItemVisible(item, widget)) {
|
|
149
142
|
return false;
|
|
150
143
|
}
|
|
151
|
-
|
|
144
|
+
|
|
145
|
+
if (item.command && !this.commandRegistry.isVisible(item.command, widget)) {
|
|
152
146
|
return false;
|
|
153
147
|
}
|
|
154
|
-
if (
|
|
148
|
+
if (item.menuPath && !this.isNonEmptyMenu(item, widget)) {
|
|
155
149
|
return false;
|
|
156
150
|
}
|
|
151
|
+
|
|
157
152
|
// The item is not vetoed. Accept it
|
|
158
153
|
return true;
|
|
159
154
|
}
|
|
@@ -166,7 +161,7 @@ export class TabBarToolbarRegistry implements FrontendApplicationContribution {
|
|
|
166
161
|
* @param widget the widget that is updating the toolbar
|
|
167
162
|
* @returns `false` if the `item` should be suppressed, otherwise `true`
|
|
168
163
|
*/
|
|
169
|
-
protected isConditionalItemVisible(item:
|
|
164
|
+
protected isConditionalItemVisible(item: TabBarToolbarItem, widget: Widget): boolean {
|
|
170
165
|
if (item.isVisible && !item.isVisible(widget)) {
|
|
171
166
|
return false;
|
|
172
167
|
}
|
|
@@ -176,19 +171,6 @@ export class TabBarToolbarRegistry implements FrontendApplicationContribution {
|
|
|
176
171
|
return true;
|
|
177
172
|
}
|
|
178
173
|
|
|
179
|
-
/**
|
|
180
|
-
* Query whether a tab-bar toolbar `item` that has a command should be shown in the toolbar.
|
|
181
|
-
* This implementation returns `false` if the `item`'s command is not visible in the
|
|
182
|
-
* `widget` according to the command registry.
|
|
183
|
-
*
|
|
184
|
-
* @param item a tab-bar toolbar item that has a non-empty `command`
|
|
185
|
-
* @param widget the widget that is updating the toolbar
|
|
186
|
-
* @returns `false` if the `item` should be suppressed, otherwise `true`
|
|
187
|
-
*/
|
|
188
|
-
protected isTabBarToolbarItemVisible(item: TabBarToolbarItem, widget: Widget): boolean {
|
|
189
|
-
return this.commandRegistry.isVisible(item.command, widget);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
174
|
/**
|
|
193
175
|
* Query whether a menu toolbar `item` should be shown in the toolbar.
|
|
194
176
|
* This implementation returns `false` if the `item` does not have any actual menu to show.
|
|
@@ -197,7 +179,10 @@ export class TabBarToolbarRegistry implements FrontendApplicationContribution {
|
|
|
197
179
|
* @param widget the widget that is updating the toolbar
|
|
198
180
|
* @returns `false` if the `item` should be suppressed, otherwise `true`
|
|
199
181
|
*/
|
|
200
|
-
|
|
182
|
+
isNonEmptyMenu(item: TabBarToolbarItem, widget: Widget | undefined): boolean {
|
|
183
|
+
if (!item.menuPath) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
201
186
|
const menu = this.menuRegistry.getMenu(item.menuPath);
|
|
202
187
|
const isVisible: (node: MenuNode) => boolean = node =>
|
|
203
188
|
node.children?.length
|
|
@@ -220,7 +205,7 @@ export class TabBarToolbarRegistry implements FrontendApplicationContribution {
|
|
|
220
205
|
}
|
|
221
206
|
}
|
|
222
207
|
|
|
223
|
-
registerMenuDelegate(menuPath: MenuPath, when?:
|
|
208
|
+
registerMenuDelegate(menuPath: MenuPath, when?: ((widget: Widget) => boolean)): Disposable {
|
|
224
209
|
const id = this.toElementId(menuPath);
|
|
225
210
|
if (!this.menuDelegates.has(id)) {
|
|
226
211
|
const isVisible: MenuDelegate['isVisible'] = !when
|