@theia/editor 1.34.1 → 1.34.3
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/LICENSE +641 -641
- package/README.md +30 -30
- package/lib/browser/decorations/editor-decoration-style.d.ts +8 -8
- package/lib/browser/decorations/editor-decoration-style.js +36 -36
- package/lib/browser/decorations/editor-decoration.d.ts +106 -106
- package/lib/browser/decorations/editor-decoration.js +37 -37
- package/lib/browser/decorations/editor-decorator.d.ts +6 -6
- package/lib/browser/decorations/editor-decorator.js +43 -43
- package/lib/browser/decorations/index.d.ts +3 -3
- package/lib/browser/decorations/index.js +30 -30
- package/lib/browser/diff-navigator.d.ts +10 -10
- package/lib/browser/diff-navigator.js +19 -19
- package/lib/browser/editor-command.d.ts +102 -102
- package/lib/browser/editor-command.js +426 -426
- package/lib/browser/editor-contribution.d.ts +26 -26
- package/lib/browser/editor-contribution.js +198 -198
- package/lib/browser/editor-frontend-module.d.ts +5 -5
- package/lib/browser/editor-frontend-module.js +74 -74
- package/lib/browser/editor-generated-preference-schema.d.ts +249 -249
- package/lib/browser/editor-generated-preference-schema.js +2316 -2316
- package/lib/browser/editor-keybinding-contexts.d.ts +35 -35
- package/lib/browser/editor-keybinding-contexts.js +98 -98
- package/lib/browser/editor-keybinding.d.ts +5 -5
- package/lib/browser/editor-keybinding.js +55 -55
- package/lib/browser/editor-manager.d.ts +113 -113
- package/lib/browser/editor-manager.js +412 -412
- package/lib/browser/editor-menu.d.ts +48 -48
- package/lib/browser/editor-menu.js +210 -210
- package/lib/browser/editor-navigation-contribution.d.ts +67 -67
- package/lib/browser/editor-navigation-contribution.js +331 -331
- package/lib/browser/editor-preferences.d.ts +40 -40
- package/lib/browser/editor-preferences.js +165 -165
- package/lib/browser/editor-variable-contribution.d.ts +8 -8
- package/lib/browser/editor-variable-contribution.js +64 -64
- package/lib/browser/editor-widget-factory.d.ts +17 -17
- package/lib/browser/editor-widget-factory.js +91 -91
- package/lib/browser/editor-widget.d.ts +20 -20
- package/lib/browser/editor-widget.js +87 -87
- package/lib/browser/editor.d.ts +293 -293
- package/lib/browser/editor.js +103 -103
- package/lib/browser/index.d.ts +10 -10
- package/lib/browser/index.js +37 -37
- package/lib/browser/language-status/editor-language-status-service.d.ts +77 -77
- package/lib/browser/language-status/editor-language-status-service.js +251 -251
- package/lib/browser/navigation/navigation-location-service.d.ts +103 -103
- package/lib/browser/navigation/navigation-location-service.js +281 -281
- package/lib/browser/navigation/navigation-location-service.spec.d.ts +1 -1
- package/lib/browser/navigation/navigation-location-service.spec.js +184 -184
- package/lib/browser/navigation/navigation-location-similarity.d.ts +15 -15
- package/lib/browser/navigation/navigation-location-similarity.js +62 -62
- package/lib/browser/navigation/navigation-location-similarity.spec.d.ts +1 -1
- package/lib/browser/navigation/navigation-location-similarity.spec.js +32 -32
- package/lib/browser/navigation/navigation-location-updater.d.ts +35 -35
- package/lib/browser/navigation/navigation-location-updater.js +210 -210
- package/lib/browser/navigation/navigation-location-updater.spec.d.ts +1 -1
- package/lib/browser/navigation/navigation-location-updater.spec.js +177 -177
- package/lib/browser/navigation/navigation-location.d.ts +191 -191
- package/lib/browser/navigation/navigation-location.js +300 -300
- package/lib/browser/navigation/test/mock-navigation-location-updater.d.ts +15 -15
- package/lib/browser/navigation/test/mock-navigation-location-updater.js +38 -38
- package/lib/browser/quick-editor-service.d.ts +16 -16
- package/lib/browser/quick-editor-service.js +109 -109
- package/lib/common/language-selector.d.ts +13 -13
- package/lib/common/language-selector.js +90 -90
- package/lib/package.spec.js +25 -25
- package/package.json +5 -5
- package/src/browser/decorations/editor-decoration-style.ts +41 -41
- package/src/browser/decorations/editor-decoration.ts +127 -127
- package/src/browser/decorations/editor-decorator.ts +36 -36
- package/src/browser/decorations/index.ts +19 -19
- package/src/browser/diff-navigator.ts +28 -28
- package/src/browser/editor-command.ts +414 -414
- package/src/browser/editor-contribution.ts +185 -185
- package/src/browser/editor-frontend-module.ts +85 -85
- package/src/browser/editor-generated-preference-schema.ts +2539 -2539
- package/src/browser/editor-keybinding-contexts.ts +87 -87
- package/src/browser/editor-keybinding.ts +55 -55
- package/src/browser/editor-manager.ts +429 -429
- package/src/browser/editor-menu.ts +224 -224
- package/src/browser/editor-navigation-contribution.ts +331 -331
- package/src/browser/editor-preferences.ts +220 -220
- package/src/browser/editor-variable-contribution.ts +54 -54
- package/src/browser/editor-widget-factory.ts +82 -82
- package/src/browser/editor-widget.ts +98 -98
- package/src/browser/editor.ts +358 -358
- package/src/browser/index.ts +26 -26
- package/src/browser/language-status/editor-language-status-service.ts +271 -271
- package/src/browser/language-status/editor-language-status.css +98 -98
- package/src/browser/navigation/navigation-location-service.spec.ts +245 -245
- package/src/browser/navigation/navigation-location-service.ts +284 -284
- package/src/browser/navigation/navigation-location-similarity.spec.ts +46 -46
- package/src/browser/navigation/navigation-location-similarity.ts +58 -58
- package/src/browser/navigation/navigation-location-updater.spec.ts +197 -197
- package/src/browser/navigation/navigation-location-updater.ts +220 -220
- package/src/browser/navigation/navigation-location.ts +418 -418
- package/src/browser/navigation/test/mock-navigation-location-updater.ts +41 -41
- package/src/browser/quick-editor-service.ts +94 -94
- package/src/browser/style/index.css +19 -19
- package/src/common/language-selector.ts +104 -104
- package/src/package.spec.ts +28 -28
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2018 TypeFox and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
var EditorWidgetFactory_1;
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.EditorWidgetFactory = void 0;
|
|
29
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
30
|
-
const uri_1 = require("@theia/core/lib/common/uri");
|
|
31
|
-
const common_1 = require("@theia/core/lib/common");
|
|
32
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
33
|
-
const editor_widget_1 = require("./editor-widget");
|
|
34
|
-
const editor_1 = require("./editor");
|
|
35
|
-
let EditorWidgetFactory = EditorWidgetFactory_1 = class EditorWidgetFactory {
|
|
36
|
-
constructor() {
|
|
37
|
-
this.id = EditorWidgetFactory_1.ID;
|
|
38
|
-
}
|
|
39
|
-
static createID(uri, counter) {
|
|
40
|
-
return EditorWidgetFactory_1.ID
|
|
41
|
-
+ `:${uri.toString()}`
|
|
42
|
-
+ (counter !== undefined ? `:${counter}` : '');
|
|
43
|
-
}
|
|
44
|
-
createWidget(options) {
|
|
45
|
-
const uri = new uri_1.default(options.uri);
|
|
46
|
-
return this.createEditor(uri, options);
|
|
47
|
-
}
|
|
48
|
-
async createEditor(uri, options) {
|
|
49
|
-
const newEditor = await this.constructEditor(uri);
|
|
50
|
-
this.setLabels(newEditor, uri);
|
|
51
|
-
const labelListener = this.labelProvider.onDidChange(event => {
|
|
52
|
-
if (event.affects(uri)) {
|
|
53
|
-
this.setLabels(newEditor, uri);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
newEditor.onDispose(() => labelListener.dispose());
|
|
57
|
-
newEditor.id = EditorWidgetFactory_1.createID(uri, options === null || options === void 0 ? void 0 : options.counter);
|
|
58
|
-
newEditor.title.closable = true;
|
|
59
|
-
return newEditor;
|
|
60
|
-
}
|
|
61
|
-
async constructEditor(uri) {
|
|
62
|
-
const textEditor = await this.editorProvider(uri);
|
|
63
|
-
return new editor_widget_1.EditorWidget(textEditor, this.selectionService);
|
|
64
|
-
}
|
|
65
|
-
setLabels(editor, uri) {
|
|
66
|
-
editor.title.caption = uri.path.fsPath();
|
|
67
|
-
if (editor.editor.isReadonly) {
|
|
68
|
-
editor.title.caption += ` • ${common_1.nls.localizeByDefault('Read Only')}`;
|
|
69
|
-
}
|
|
70
|
-
const icon = this.labelProvider.getIcon(uri);
|
|
71
|
-
editor.title.label = this.labelProvider.getName(uri);
|
|
72
|
-
editor.title.iconClass = icon + ' file-icon';
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
EditorWidgetFactory.ID = 'code-editor-opener';
|
|
76
|
-
__decorate([
|
|
77
|
-
(0, inversify_1.inject)(browser_1.LabelProvider),
|
|
78
|
-
__metadata("design:type", browser_1.LabelProvider)
|
|
79
|
-
], EditorWidgetFactory.prototype, "labelProvider", void 0);
|
|
80
|
-
__decorate([
|
|
81
|
-
(0, inversify_1.inject)(editor_1.TextEditorProvider),
|
|
82
|
-
__metadata("design:type", Function)
|
|
83
|
-
], EditorWidgetFactory.prototype, "editorProvider", void 0);
|
|
84
|
-
__decorate([
|
|
85
|
-
(0, inversify_1.inject)(common_1.SelectionService),
|
|
86
|
-
__metadata("design:type", common_1.SelectionService)
|
|
87
|
-
], EditorWidgetFactory.prototype, "selectionService", void 0);
|
|
88
|
-
EditorWidgetFactory = EditorWidgetFactory_1 = __decorate([
|
|
89
|
-
(0, inversify_1.injectable)()
|
|
90
|
-
], EditorWidgetFactory);
|
|
91
|
-
exports.EditorWidgetFactory = EditorWidgetFactory;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2018 TypeFox and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var EditorWidgetFactory_1;
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.EditorWidgetFactory = void 0;
|
|
29
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
30
|
+
const uri_1 = require("@theia/core/lib/common/uri");
|
|
31
|
+
const common_1 = require("@theia/core/lib/common");
|
|
32
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
33
|
+
const editor_widget_1 = require("./editor-widget");
|
|
34
|
+
const editor_1 = require("./editor");
|
|
35
|
+
let EditorWidgetFactory = EditorWidgetFactory_1 = class EditorWidgetFactory {
|
|
36
|
+
constructor() {
|
|
37
|
+
this.id = EditorWidgetFactory_1.ID;
|
|
38
|
+
}
|
|
39
|
+
static createID(uri, counter) {
|
|
40
|
+
return EditorWidgetFactory_1.ID
|
|
41
|
+
+ `:${uri.toString()}`
|
|
42
|
+
+ (counter !== undefined ? `:${counter}` : '');
|
|
43
|
+
}
|
|
44
|
+
createWidget(options) {
|
|
45
|
+
const uri = new uri_1.default(options.uri);
|
|
46
|
+
return this.createEditor(uri, options);
|
|
47
|
+
}
|
|
48
|
+
async createEditor(uri, options) {
|
|
49
|
+
const newEditor = await this.constructEditor(uri);
|
|
50
|
+
this.setLabels(newEditor, uri);
|
|
51
|
+
const labelListener = this.labelProvider.onDidChange(event => {
|
|
52
|
+
if (event.affects(uri)) {
|
|
53
|
+
this.setLabels(newEditor, uri);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
newEditor.onDispose(() => labelListener.dispose());
|
|
57
|
+
newEditor.id = EditorWidgetFactory_1.createID(uri, options === null || options === void 0 ? void 0 : options.counter);
|
|
58
|
+
newEditor.title.closable = true;
|
|
59
|
+
return newEditor;
|
|
60
|
+
}
|
|
61
|
+
async constructEditor(uri) {
|
|
62
|
+
const textEditor = await this.editorProvider(uri);
|
|
63
|
+
return new editor_widget_1.EditorWidget(textEditor, this.selectionService);
|
|
64
|
+
}
|
|
65
|
+
setLabels(editor, uri) {
|
|
66
|
+
editor.title.caption = uri.path.fsPath();
|
|
67
|
+
if (editor.editor.isReadonly) {
|
|
68
|
+
editor.title.caption += ` • ${common_1.nls.localizeByDefault('Read Only')}`;
|
|
69
|
+
}
|
|
70
|
+
const icon = this.labelProvider.getIcon(uri);
|
|
71
|
+
editor.title.label = this.labelProvider.getName(uri);
|
|
72
|
+
editor.title.iconClass = icon + ' file-icon';
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
EditorWidgetFactory.ID = 'code-editor-opener';
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, inversify_1.inject)(browser_1.LabelProvider),
|
|
78
|
+
__metadata("design:type", browser_1.LabelProvider)
|
|
79
|
+
], EditorWidgetFactory.prototype, "labelProvider", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, inversify_1.inject)(editor_1.TextEditorProvider),
|
|
82
|
+
__metadata("design:type", Function)
|
|
83
|
+
], EditorWidgetFactory.prototype, "editorProvider", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, inversify_1.inject)(common_1.SelectionService),
|
|
86
|
+
__metadata("design:type", common_1.SelectionService)
|
|
87
|
+
], EditorWidgetFactory.prototype, "selectionService", void 0);
|
|
88
|
+
EditorWidgetFactory = EditorWidgetFactory_1 = __decorate([
|
|
89
|
+
(0, inversify_1.injectable)()
|
|
90
|
+
], EditorWidgetFactory);
|
|
91
|
+
exports.EditorWidgetFactory = EditorWidgetFactory;
|
|
92
92
|
//# sourceMappingURL=editor-widget-factory.js.map
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { SelectionService, Event } from '@theia/core/lib/common';
|
|
2
|
-
import { Widget, BaseWidget, Message, Saveable, SaveableSource, Navigatable, StatefulWidget } from '@theia/core/lib/browser';
|
|
3
|
-
import URI from '@theia/core/lib/common/uri';
|
|
4
|
-
import { TextEditor } from './editor';
|
|
5
|
-
export declare class EditorWidget extends BaseWidget implements SaveableSource, Navigatable, StatefulWidget {
|
|
6
|
-
readonly editor: TextEditor;
|
|
7
|
-
protected readonly selectionService: SelectionService;
|
|
8
|
-
constructor(editor: TextEditor, selectionService: SelectionService);
|
|
9
|
-
setSelection(): void;
|
|
10
|
-
get saveable(): Saveable;
|
|
11
|
-
getResourceUri(): URI | undefined;
|
|
12
|
-
createMoveToUri(resourceUri: URI): URI | undefined;
|
|
13
|
-
protected onActivateRequest(msg: Message): void;
|
|
14
|
-
protected onAfterAttach(msg: Message): void;
|
|
15
|
-
protected onAfterShow(msg: Message): void;
|
|
16
|
-
protected onResize(msg: Widget.ResizeMessage): void;
|
|
17
|
-
storeState(): object | undefined;
|
|
18
|
-
restoreState(oldState: object): void;
|
|
19
|
-
get onDispose(): Event<void>;
|
|
20
|
-
}
|
|
1
|
+
import { SelectionService, Event } from '@theia/core/lib/common';
|
|
2
|
+
import { Widget, BaseWidget, Message, Saveable, SaveableSource, Navigatable, StatefulWidget } from '@theia/core/lib/browser';
|
|
3
|
+
import URI from '@theia/core/lib/common/uri';
|
|
4
|
+
import { TextEditor } from './editor';
|
|
5
|
+
export declare class EditorWidget extends BaseWidget implements SaveableSource, Navigatable, StatefulWidget {
|
|
6
|
+
readonly editor: TextEditor;
|
|
7
|
+
protected readonly selectionService: SelectionService;
|
|
8
|
+
constructor(editor: TextEditor, selectionService: SelectionService);
|
|
9
|
+
setSelection(): void;
|
|
10
|
+
get saveable(): Saveable;
|
|
11
|
+
getResourceUri(): URI | undefined;
|
|
12
|
+
createMoveToUri(resourceUri: URI): URI | undefined;
|
|
13
|
+
protected onActivateRequest(msg: Message): void;
|
|
14
|
+
protected onAfterAttach(msg: Message): void;
|
|
15
|
+
protected onAfterShow(msg: Message): void;
|
|
16
|
+
protected onResize(msg: Widget.ResizeMessage): void;
|
|
17
|
+
storeState(): object | undefined;
|
|
18
|
+
restoreState(oldState: object): void;
|
|
19
|
+
get onDispose(): Event<void>;
|
|
20
|
+
}
|
|
21
21
|
//# sourceMappingURL=editor-widget.d.ts.map
|
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2017 TypeFox and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.EditorWidget = void 0;
|
|
19
|
-
const common_1 = require("@theia/core/lib/common");
|
|
20
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
21
|
-
class EditorWidget extends browser_1.BaseWidget {
|
|
22
|
-
constructor(editor, selectionService) {
|
|
23
|
-
super(editor);
|
|
24
|
-
this.editor = editor;
|
|
25
|
-
this.selectionService = selectionService;
|
|
26
|
-
this.addClass('theia-editor');
|
|
27
|
-
if (editor.isReadonly) {
|
|
28
|
-
(0, browser_1.lock)(this.title);
|
|
29
|
-
}
|
|
30
|
-
this.toDispose.push(this.editor);
|
|
31
|
-
this.toDispose.push(this.editor.onSelectionChanged(() => this.setSelection()));
|
|
32
|
-
this.toDispose.push(this.editor.onFocusChanged(() => this.setSelection()));
|
|
33
|
-
this.toDispose.push(common_1.Disposable.create(() => {
|
|
34
|
-
if (this.selectionService.selection === this.editor) {
|
|
35
|
-
this.selectionService.selection = undefined;
|
|
36
|
-
}
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
39
|
-
setSelection() {
|
|
40
|
-
if (this.editor.isFocused() && this.selectionService.selection !== this.editor) {
|
|
41
|
-
this.selectionService.selection = this.editor;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
get saveable() {
|
|
45
|
-
return this.editor.document;
|
|
46
|
-
}
|
|
47
|
-
getResourceUri() {
|
|
48
|
-
return this.editor.getResourceUri();
|
|
49
|
-
}
|
|
50
|
-
createMoveToUri(resourceUri) {
|
|
51
|
-
return this.editor.createMoveToUri(resourceUri);
|
|
52
|
-
}
|
|
53
|
-
onActivateRequest(msg) {
|
|
54
|
-
super.onActivateRequest(msg);
|
|
55
|
-
this.editor.focus();
|
|
56
|
-
this.selectionService.selection = this.editor;
|
|
57
|
-
}
|
|
58
|
-
onAfterAttach(msg) {
|
|
59
|
-
super.onAfterAttach(msg);
|
|
60
|
-
if (this.isVisible) {
|
|
61
|
-
this.editor.refresh();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
onAfterShow(msg) {
|
|
65
|
-
super.onAfterShow(msg);
|
|
66
|
-
this.editor.refresh();
|
|
67
|
-
}
|
|
68
|
-
onResize(msg) {
|
|
69
|
-
if (msg.width < 0 || msg.height < 0) {
|
|
70
|
-
this.editor.resizeToFit();
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.editor.setSize(msg);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
storeState() {
|
|
77
|
-
var _a;
|
|
78
|
-
return ((_a = this.getResourceUri()) === null || _a === void 0 ? void 0 : _a.scheme) === common_1.UNTITLED_SCHEME ? undefined : this.editor.storeViewState();
|
|
79
|
-
}
|
|
80
|
-
restoreState(oldState) {
|
|
81
|
-
this.editor.restoreViewState(oldState);
|
|
82
|
-
}
|
|
83
|
-
get onDispose() {
|
|
84
|
-
return this.toDispose.onDispose;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
exports.EditorWidget = EditorWidget;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2017 TypeFox and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.EditorWidget = void 0;
|
|
19
|
+
const common_1 = require("@theia/core/lib/common");
|
|
20
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
21
|
+
class EditorWidget extends browser_1.BaseWidget {
|
|
22
|
+
constructor(editor, selectionService) {
|
|
23
|
+
super(editor);
|
|
24
|
+
this.editor = editor;
|
|
25
|
+
this.selectionService = selectionService;
|
|
26
|
+
this.addClass('theia-editor');
|
|
27
|
+
if (editor.isReadonly) {
|
|
28
|
+
(0, browser_1.lock)(this.title);
|
|
29
|
+
}
|
|
30
|
+
this.toDispose.push(this.editor);
|
|
31
|
+
this.toDispose.push(this.editor.onSelectionChanged(() => this.setSelection()));
|
|
32
|
+
this.toDispose.push(this.editor.onFocusChanged(() => this.setSelection()));
|
|
33
|
+
this.toDispose.push(common_1.Disposable.create(() => {
|
|
34
|
+
if (this.selectionService.selection === this.editor) {
|
|
35
|
+
this.selectionService.selection = undefined;
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
setSelection() {
|
|
40
|
+
if (this.editor.isFocused() && this.selectionService.selection !== this.editor) {
|
|
41
|
+
this.selectionService.selection = this.editor;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
get saveable() {
|
|
45
|
+
return this.editor.document;
|
|
46
|
+
}
|
|
47
|
+
getResourceUri() {
|
|
48
|
+
return this.editor.getResourceUri();
|
|
49
|
+
}
|
|
50
|
+
createMoveToUri(resourceUri) {
|
|
51
|
+
return this.editor.createMoveToUri(resourceUri);
|
|
52
|
+
}
|
|
53
|
+
onActivateRequest(msg) {
|
|
54
|
+
super.onActivateRequest(msg);
|
|
55
|
+
this.editor.focus();
|
|
56
|
+
this.selectionService.selection = this.editor;
|
|
57
|
+
}
|
|
58
|
+
onAfterAttach(msg) {
|
|
59
|
+
super.onAfterAttach(msg);
|
|
60
|
+
if (this.isVisible) {
|
|
61
|
+
this.editor.refresh();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
onAfterShow(msg) {
|
|
65
|
+
super.onAfterShow(msg);
|
|
66
|
+
this.editor.refresh();
|
|
67
|
+
}
|
|
68
|
+
onResize(msg) {
|
|
69
|
+
if (msg.width < 0 || msg.height < 0) {
|
|
70
|
+
this.editor.resizeToFit();
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
this.editor.setSize(msg);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
storeState() {
|
|
77
|
+
var _a;
|
|
78
|
+
return ((_a = this.getResourceUri()) === null || _a === void 0 ? void 0 : _a.scheme) === common_1.UNTITLED_SCHEME ? undefined : this.editor.storeViewState();
|
|
79
|
+
}
|
|
80
|
+
restoreState(oldState) {
|
|
81
|
+
this.editor.restoreViewState(oldState);
|
|
82
|
+
}
|
|
83
|
+
get onDispose() {
|
|
84
|
+
return this.toDispose.onDispose;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.EditorWidget = EditorWidget;
|
|
88
88
|
//# sourceMappingURL=editor-widget.js.map
|