@theia/scm 1.45.0 → 1.46.0-next.72
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 +31 -31
- package/lib/browser/decorations/scm-decorations-service.d.ts +14 -14
- package/lib/browser/decorations/scm-decorations-service.js +101 -101
- package/lib/browser/decorations/scm-navigator-decorator.d.ts +25 -25
- package/lib/browser/decorations/scm-navigator-decorator.js +132 -132
- package/lib/browser/decorations/scm-tab-bar-decorator.d.ts +17 -17
- package/lib/browser/decorations/scm-tab-bar-decorator.js +93 -93
- package/lib/browser/dirty-diff/content-lines.d.ts +12 -12
- package/lib/browser/dirty-diff/content-lines.js +106 -106
- package/lib/browser/dirty-diff/content-lines.spec.d.ts +1 -1
- package/lib/browser/dirty-diff/content-lines.spec.js +39 -39
- package/lib/browser/dirty-diff/diff-computer.d.ts +29 -29
- package/lib/browser/dirty-diff/diff-computer.js +102 -102
- package/lib/browser/dirty-diff/diff-computer.spec.d.ts +1 -1
- package/lib/browser/dirty-diff/diff-computer.spec.js +315 -315
- package/lib/browser/dirty-diff/dirty-diff-decorator.d.ts +14 -14
- package/lib/browser/dirty-diff/dirty-diff-decorator.js +98 -98
- package/lib/browser/dirty-diff/dirty-diff-module.d.ts +3 -3
- package/lib/browser/dirty-diff/dirty-diff-module.js +24 -24
- package/lib/browser/scm-amend-component.d.ts +123 -123
- package/lib/browser/scm-amend-component.js +463 -463
- package/lib/browser/scm-amend-widget.d.ts +20 -20
- package/lib/browser/scm-amend-widget.js +101 -101
- package/lib/browser/scm-avatar-service.d.ts +3 -3
- package/lib/browser/scm-avatar-service.js +36 -36
- package/lib/browser/scm-commit-widget.d.ts +52 -52
- package/lib/browser/scm-commit-widget.js +199 -199
- package/lib/browser/scm-context-key-service.d.ts +10 -10
- package/lib/browser/scm-context-key-service.js +58 -58
- package/lib/browser/scm-contribution.d.ts +83 -83
- package/lib/browser/scm-contribution.js +356 -356
- package/lib/browser/scm-frontend-module.d.ts +6 -6
- package/lib/browser/scm-frontend-module.js +130 -130
- package/lib/browser/scm-groups-tree-model.d.ts +14 -14
- package/lib/browser/scm-groups-tree-model.js +97 -97
- package/lib/browser/scm-input.d.ts +53 -53
- package/lib/browser/scm-input.js +127 -127
- package/lib/browser/scm-layout-migrations.d.ts +9 -9
- package/lib/browser/scm-layout-migrations.js +79 -79
- package/lib/browser/scm-no-repository-widget.d.ts +8 -8
- package/lib/browser/scm-no-repository-widget.js +49 -49
- package/lib/browser/scm-preferences.d.ts +11 -11
- package/lib/browser/scm-preferences.js +51 -51
- package/lib/browser/scm-provider.d.ts +58 -58
- package/lib/browser/scm-provider.js +19 -19
- package/lib/browser/scm-quick-open-service.d.ts +11 -11
- package/lib/browser/scm-quick-open-service.js +73 -73
- package/lib/browser/scm-repository.d.ts +17 -17
- package/lib/browser/scm-repository.js +41 -41
- package/lib/browser/scm-service.d.ts +26 -26
- package/lib/browser/scm-service.js +108 -108
- package/lib/browser/scm-tree-label-provider.d.ts +7 -7
- package/lib/browser/scm-tree-label-provider.js +57 -57
- package/lib/browser/scm-tree-model.d.ts +74 -74
- package/lib/browser/scm-tree-model.js +351 -351
- package/lib/browser/scm-tree-widget.d.ts +208 -208
- package/lib/browser/scm-tree-widget.js +703 -703
- package/lib/browser/scm-widget.d.ts +40 -40
- package/lib/browser/scm-widget.js +218 -218
- package/package.json +6 -6
- package/src/browser/decorations/scm-decorations-service.ts +78 -78
- package/src/browser/decorations/scm-navigator-decorator.ts +121 -121
- package/src/browser/decorations/scm-tab-bar-decorator.ts +83 -83
- package/src/browser/dirty-diff/content-lines.spec.ts +42 -42
- package/src/browser/dirty-diff/content-lines.ts +112 -112
- package/src/browser/dirty-diff/diff-computer.spec.ts +387 -387
- package/src/browser/dirty-diff/diff-computer.ts +129 -129
- package/src/browser/dirty-diff/dirty-diff-decorator.ts +107 -107
- package/src/browser/dirty-diff/dirty-diff-module.ts +24 -24
- package/src/browser/scm-amend-component.tsx +600 -600
- package/src/browser/scm-amend-widget.tsx +77 -77
- package/src/browser/scm-avatar-service.ts +27 -27
- package/src/browser/scm-commit-widget.tsx +215 -215
- package/src/browser/scm-context-key-service.ts +46 -46
- package/src/browser/scm-contribution.ts +361 -361
- package/src/browser/scm-frontend-module.ts +149 -149
- package/src/browser/scm-groups-tree-model.ts +78 -78
- package/src/browser/scm-input.ts +164 -164
- package/src/browser/scm-layout-migrations.ts +64 -64
- package/src/browser/scm-no-repository-widget.tsx +41 -41
- package/src/browser/scm-preferences.ts +63 -63
- package/src/browser/scm-provider.ts +91 -91
- package/src/browser/scm-quick-open-service.ts +48 -48
- package/src/browser/scm-repository.ts +52 -52
- package/src/browser/scm-service.ts +108 -108
- package/src/browser/scm-tree-label-provider.ts +44 -44
- package/src/browser/scm-tree-model.ts +405 -405
- package/src/browser/scm-tree-widget.tsx +838 -838
- package/src/browser/scm-widget.tsx +204 -204
- package/src/browser/style/dirty-diff-decorator.css +52 -52
- package/src/browser/style/dirty-diff.css +50 -50
- package/src/browser/style/index.css +271 -271
- package/src/browser/style/scm-amend-component.css +94 -94
- package/src/browser/style/scm.svg +4 -4
package/README.md
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
<div align='center'>
|
|
2
|
-
|
|
3
|
-
<br />
|
|
4
|
-
|
|
5
|
-
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
-
|
|
7
|
-
<h2>ECLIPSE THEIA - SCM EXTENSION</h2>
|
|
8
|
-
|
|
9
|
-
<hr />
|
|
10
|
-
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
## Description
|
|
14
|
-
|
|
15
|
-
The `@theia/scm` extension adds support for handling multiple source control managers, and includes a `SCM` (Source Control Manager) View which different source control providers (such as `Git` and `Mercurial`) can contribute to.
|
|
16
|
-
|
|
17
|
-
## Additional Information
|
|
18
|
-
|
|
19
|
-
- [API documentation for `@theia/scm`](https://eclipse-theia.github.io/theia/docs/next/modules/scm.html)
|
|
20
|
-
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
21
|
-
- [Theia - Website](https://theia-ide.org/)
|
|
22
|
-
- [VS Code SCM Documentation](https://code.visualstudio.com/docs/editor/versioncontrol)
|
|
23
|
-
|
|
24
|
-
## License
|
|
25
|
-
|
|
26
|
-
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
27
|
-
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
28
|
-
|
|
29
|
-
## Trademark
|
|
30
|
-
"Theia" is a trademark of the Eclipse Foundation
|
|
31
|
-
https://www.eclipse.org/theia
|
|
1
|
+
<div align='center'>
|
|
2
|
+
|
|
3
|
+
<br />
|
|
4
|
+
|
|
5
|
+
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
+
|
|
7
|
+
<h2>ECLIPSE THEIA - SCM EXTENSION</h2>
|
|
8
|
+
|
|
9
|
+
<hr />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## Description
|
|
14
|
+
|
|
15
|
+
The `@theia/scm` extension adds support for handling multiple source control managers, and includes a `SCM` (Source Control Manager) View which different source control providers (such as `Git` and `Mercurial`) can contribute to.
|
|
16
|
+
|
|
17
|
+
## Additional Information
|
|
18
|
+
|
|
19
|
+
- [API documentation for `@theia/scm`](https://eclipse-theia.github.io/theia/docs/next/modules/scm.html)
|
|
20
|
+
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
21
|
+
- [Theia - Website](https://theia-ide.org/)
|
|
22
|
+
- [VS Code SCM Documentation](https://code.visualstudio.com/docs/editor/versioncontrol)
|
|
23
|
+
|
|
24
|
+
## License
|
|
25
|
+
|
|
26
|
+
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
27
|
+
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
28
|
+
|
|
29
|
+
## Trademark
|
|
30
|
+
"Theia" is a trademark of the Eclipse Foundation
|
|
31
|
+
https://www.eclipse.org/theia
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ResourceProvider } from '@theia/core';
|
|
2
|
-
import { DirtyDiffDecorator } from '../dirty-diff/dirty-diff-decorator';
|
|
3
|
-
import { EditorManager, TextEditor } from '@theia/editor/lib/browser';
|
|
4
|
-
import { ScmService } from '../scm-service';
|
|
5
|
-
export declare class ScmDecorationsService {
|
|
6
|
-
protected readonly decorator: DirtyDiffDecorator;
|
|
7
|
-
protected readonly scmService: ScmService;
|
|
8
|
-
protected readonly editorManager: EditorManager;
|
|
9
|
-
protected readonly resourceProvider: ResourceProvider;
|
|
10
|
-
private readonly diffComputer;
|
|
11
|
-
private dirtyState;
|
|
12
|
-
constructor(decorator: DirtyDiffDecorator, scmService: ScmService, editorManager: EditorManager, resourceProvider: ResourceProvider);
|
|
13
|
-
applyEditorDecorations(editor: TextEditor): Promise<void>;
|
|
14
|
-
}
|
|
1
|
+
import { ResourceProvider } from '@theia/core';
|
|
2
|
+
import { DirtyDiffDecorator } from '../dirty-diff/dirty-diff-decorator';
|
|
3
|
+
import { EditorManager, TextEditor } from '@theia/editor/lib/browser';
|
|
4
|
+
import { ScmService } from '../scm-service';
|
|
5
|
+
export declare class ScmDecorationsService {
|
|
6
|
+
protected readonly decorator: DirtyDiffDecorator;
|
|
7
|
+
protected readonly scmService: ScmService;
|
|
8
|
+
protected readonly editorManager: EditorManager;
|
|
9
|
+
protected readonly resourceProvider: ResourceProvider;
|
|
10
|
+
private readonly diffComputer;
|
|
11
|
+
private dirtyState;
|
|
12
|
+
constructor(decorator: DirtyDiffDecorator, scmService: ScmService, editorManager: EditorManager, resourceProvider: ResourceProvider);
|
|
13
|
+
applyEditorDecorations(editor: TextEditor): Promise<void>;
|
|
14
|
+
}
|
|
15
15
|
//# sourceMappingURL=scm-decorations-service.d.ts.map
|
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2019 Red Hat, Inc. 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-only 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 __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.ScmDecorationsService = void 0;
|
|
31
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
32
|
-
const core_1 = require("@theia/core");
|
|
33
|
-
const dirty_diff_decorator_1 = require("../dirty-diff/dirty-diff-decorator");
|
|
34
|
-
const diff_computer_1 = require("../dirty-diff/diff-computer");
|
|
35
|
-
const content_lines_1 = require("../dirty-diff/content-lines");
|
|
36
|
-
const browser_1 = require("@theia/editor/lib/browser");
|
|
37
|
-
const scm_service_1 = require("../scm-service");
|
|
38
|
-
let ScmDecorationsService = class ScmDecorationsService {
|
|
39
|
-
constructor(decorator, scmService, editorManager, resourceProvider) {
|
|
40
|
-
this.decorator = decorator;
|
|
41
|
-
this.scmService = scmService;
|
|
42
|
-
this.editorManager = editorManager;
|
|
43
|
-
this.resourceProvider = resourceProvider;
|
|
44
|
-
this.dirtyState = true;
|
|
45
|
-
this.diffComputer = new diff_computer_1.DiffComputer();
|
|
46
|
-
this.editorManager.onCreated(async (editor) => this.applyEditorDecorations(editor.editor));
|
|
47
|
-
this.scmService.onDidAddRepository(repository => repository.provider.onDidChange(() => {
|
|
48
|
-
const editor = this.editorManager.currentEditor;
|
|
49
|
-
if (editor) {
|
|
50
|
-
if (this.dirtyState) {
|
|
51
|
-
this.applyEditorDecorations(editor.editor);
|
|
52
|
-
this.dirtyState = false;
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
/** onDidChange event might be called several times one after another, so need to prevent repeated events. */
|
|
56
|
-
setTimeout(() => {
|
|
57
|
-
this.dirtyState = true;
|
|
58
|
-
}, 500);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}));
|
|
62
|
-
this.scmService.onDidChangeSelectedRepository(() => {
|
|
63
|
-
const editor = this.editorManager.currentEditor;
|
|
64
|
-
if (editor) {
|
|
65
|
-
this.applyEditorDecorations(editor.editor);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
async applyEditorDecorations(editor) {
|
|
70
|
-
const currentRepo = this.scmService.selectedRepository;
|
|
71
|
-
if (currentRepo) {
|
|
72
|
-
try {
|
|
73
|
-
const uri = editor.uri.withScheme(currentRepo.provider.id).withQuery(`{"ref":"", "path":"${editor.uri.path.toString()}"}`);
|
|
74
|
-
const previousResource = await this.resourceProvider(uri);
|
|
75
|
-
const previousContent = await previousResource.readContents();
|
|
76
|
-
const previousLines = content_lines_1.ContentLines.fromString(previousContent);
|
|
77
|
-
const currentResource = await this.resourceProvider(editor.uri);
|
|
78
|
-
const currentContent = await currentResource.readContents();
|
|
79
|
-
const currentLines = content_lines_1.ContentLines.fromString(currentContent);
|
|
80
|
-
const { added, removed, modified } = this.diffComputer.computeDirtyDiff(content_lines_1.ContentLines.arrayLike(previousLines), content_lines_1.ContentLines.arrayLike(currentLines));
|
|
81
|
-
this.decorator.applyDecorations({ editor: editor, added, removed, modified });
|
|
82
|
-
currentResource.dispose();
|
|
83
|
-
previousResource.dispose();
|
|
84
|
-
}
|
|
85
|
-
catch (e) {
|
|
86
|
-
// Scm resource may not be found, do nothing.
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
ScmDecorationsService = __decorate([
|
|
92
|
-
(0, inversify_1.injectable)(),
|
|
93
|
-
__param(0, (0, inversify_1.inject)(dirty_diff_decorator_1.DirtyDiffDecorator)),
|
|
94
|
-
__param(1, (0, inversify_1.inject)(scm_service_1.ScmService)),
|
|
95
|
-
__param(2, (0, inversify_1.inject)(browser_1.EditorManager)),
|
|
96
|
-
__param(3, (0, inversify_1.inject)(core_1.ResourceProvider)),
|
|
97
|
-
__metadata("design:paramtypes", [dirty_diff_decorator_1.DirtyDiffDecorator,
|
|
98
|
-
scm_service_1.ScmService,
|
|
99
|
-
browser_1.EditorManager, Function])
|
|
100
|
-
], ScmDecorationsService);
|
|
101
|
-
exports.ScmDecorationsService = ScmDecorationsService;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2019 Red Hat, Inc. 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-only 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 __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.ScmDecorationsService = void 0;
|
|
31
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
32
|
+
const core_1 = require("@theia/core");
|
|
33
|
+
const dirty_diff_decorator_1 = require("../dirty-diff/dirty-diff-decorator");
|
|
34
|
+
const diff_computer_1 = require("../dirty-diff/diff-computer");
|
|
35
|
+
const content_lines_1 = require("../dirty-diff/content-lines");
|
|
36
|
+
const browser_1 = require("@theia/editor/lib/browser");
|
|
37
|
+
const scm_service_1 = require("../scm-service");
|
|
38
|
+
let ScmDecorationsService = class ScmDecorationsService {
|
|
39
|
+
constructor(decorator, scmService, editorManager, resourceProvider) {
|
|
40
|
+
this.decorator = decorator;
|
|
41
|
+
this.scmService = scmService;
|
|
42
|
+
this.editorManager = editorManager;
|
|
43
|
+
this.resourceProvider = resourceProvider;
|
|
44
|
+
this.dirtyState = true;
|
|
45
|
+
this.diffComputer = new diff_computer_1.DiffComputer();
|
|
46
|
+
this.editorManager.onCreated(async (editor) => this.applyEditorDecorations(editor.editor));
|
|
47
|
+
this.scmService.onDidAddRepository(repository => repository.provider.onDidChange(() => {
|
|
48
|
+
const editor = this.editorManager.currentEditor;
|
|
49
|
+
if (editor) {
|
|
50
|
+
if (this.dirtyState) {
|
|
51
|
+
this.applyEditorDecorations(editor.editor);
|
|
52
|
+
this.dirtyState = false;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
/** onDidChange event might be called several times one after another, so need to prevent repeated events. */
|
|
56
|
+
setTimeout(() => {
|
|
57
|
+
this.dirtyState = true;
|
|
58
|
+
}, 500);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}));
|
|
62
|
+
this.scmService.onDidChangeSelectedRepository(() => {
|
|
63
|
+
const editor = this.editorManager.currentEditor;
|
|
64
|
+
if (editor) {
|
|
65
|
+
this.applyEditorDecorations(editor.editor);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async applyEditorDecorations(editor) {
|
|
70
|
+
const currentRepo = this.scmService.selectedRepository;
|
|
71
|
+
if (currentRepo) {
|
|
72
|
+
try {
|
|
73
|
+
const uri = editor.uri.withScheme(currentRepo.provider.id).withQuery(`{"ref":"", "path":"${editor.uri.path.toString()}"}`);
|
|
74
|
+
const previousResource = await this.resourceProvider(uri);
|
|
75
|
+
const previousContent = await previousResource.readContents();
|
|
76
|
+
const previousLines = content_lines_1.ContentLines.fromString(previousContent);
|
|
77
|
+
const currentResource = await this.resourceProvider(editor.uri);
|
|
78
|
+
const currentContent = await currentResource.readContents();
|
|
79
|
+
const currentLines = content_lines_1.ContentLines.fromString(currentContent);
|
|
80
|
+
const { added, removed, modified } = this.diffComputer.computeDirtyDiff(content_lines_1.ContentLines.arrayLike(previousLines), content_lines_1.ContentLines.arrayLike(currentLines));
|
|
81
|
+
this.decorator.applyDecorations({ editor: editor, added, removed, modified });
|
|
82
|
+
currentResource.dispose();
|
|
83
|
+
previousResource.dispose();
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
// Scm resource may not be found, do nothing.
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
ScmDecorationsService = __decorate([
|
|
92
|
+
(0, inversify_1.injectable)(),
|
|
93
|
+
__param(0, (0, inversify_1.inject)(dirty_diff_decorator_1.DirtyDiffDecorator)),
|
|
94
|
+
__param(1, (0, inversify_1.inject)(scm_service_1.ScmService)),
|
|
95
|
+
__param(2, (0, inversify_1.inject)(browser_1.EditorManager)),
|
|
96
|
+
__param(3, (0, inversify_1.inject)(core_1.ResourceProvider)),
|
|
97
|
+
__metadata("design:paramtypes", [dirty_diff_decorator_1.DirtyDiffDecorator,
|
|
98
|
+
scm_service_1.ScmService,
|
|
99
|
+
browser_1.EditorManager, Function])
|
|
100
|
+
], ScmDecorationsService);
|
|
101
|
+
exports.ScmDecorationsService = ScmDecorationsService;
|
|
102
102
|
//# sourceMappingURL=scm-decorations-service.js.map
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { ILogger } from '@theia/core/lib/common/logger';
|
|
2
|
-
import { Event, Emitter } from '@theia/core/lib/common/event';
|
|
3
|
-
import { Tree } from '@theia/core/lib/browser/tree/tree';
|
|
4
|
-
import { TreeDecorator, TreeDecoration } from '@theia/core/lib/browser/tree/tree-decorator';
|
|
5
|
-
import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
|
|
6
|
-
import { Decoration, DecorationsService } from '@theia/core/lib/browser/decorations-service';
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated since 1.25.0
|
|
9
|
-
* URI-based decorators should implement `DecorationsProvider` and contribute decorations via the `DecorationsService`.
|
|
10
|
-
*/
|
|
11
|
-
export declare class ScmNavigatorDecorator implements TreeDecorator {
|
|
12
|
-
protected readonly decorationsService: DecorationsService;
|
|
13
|
-
readonly id = "theia-scm-decorator";
|
|
14
|
-
private decorationsMap;
|
|
15
|
-
protected readonly logger: ILogger;
|
|
16
|
-
protected readonly colors: ColorRegistry;
|
|
17
|
-
constructor(decorationsService: DecorationsService);
|
|
18
|
-
protected collectDecorators(tree: Tree): Map<string, TreeDecoration.Data>;
|
|
19
|
-
protected toDecorator(change: Decoration): TreeDecoration.Data;
|
|
20
|
-
protected readonly emitter: Emitter<(tree: Tree) => Map<string, TreeDecoration.Data>>;
|
|
21
|
-
decorations(tree: Tree): Promise<Map<string, TreeDecoration.Data>>;
|
|
22
|
-
protected appendContainerChanges(decorationsMap: Map<string, Decoration>): Map<string, Decoration>;
|
|
23
|
-
get onDidChangeDecorations(): Event<(tree: Tree) => Map<string, TreeDecoration.Data>>;
|
|
24
|
-
fireDidChangeDecorations(event: (tree: Tree) => Map<string, TreeDecoration.Data>): void;
|
|
25
|
-
}
|
|
1
|
+
import { ILogger } from '@theia/core/lib/common/logger';
|
|
2
|
+
import { Event, Emitter } from '@theia/core/lib/common/event';
|
|
3
|
+
import { Tree } from '@theia/core/lib/browser/tree/tree';
|
|
4
|
+
import { TreeDecorator, TreeDecoration } from '@theia/core/lib/browser/tree/tree-decorator';
|
|
5
|
+
import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
|
|
6
|
+
import { Decoration, DecorationsService } from '@theia/core/lib/browser/decorations-service';
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated since 1.25.0
|
|
9
|
+
* URI-based decorators should implement `DecorationsProvider` and contribute decorations via the `DecorationsService`.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ScmNavigatorDecorator implements TreeDecorator {
|
|
12
|
+
protected readonly decorationsService: DecorationsService;
|
|
13
|
+
readonly id = "theia-scm-decorator";
|
|
14
|
+
private decorationsMap;
|
|
15
|
+
protected readonly logger: ILogger;
|
|
16
|
+
protected readonly colors: ColorRegistry;
|
|
17
|
+
constructor(decorationsService: DecorationsService);
|
|
18
|
+
protected collectDecorators(tree: Tree): Map<string, TreeDecoration.Data>;
|
|
19
|
+
protected toDecorator(change: Decoration): TreeDecoration.Data;
|
|
20
|
+
protected readonly emitter: Emitter<(tree: Tree) => Map<string, TreeDecoration.Data>>;
|
|
21
|
+
decorations(tree: Tree): Promise<Map<string, TreeDecoration.Data>>;
|
|
22
|
+
protected appendContainerChanges(decorationsMap: Map<string, Decoration>): Map<string, Decoration>;
|
|
23
|
+
get onDidChangeDecorations(): Event<(tree: Tree) => Map<string, TreeDecoration.Data>>;
|
|
24
|
+
fireDidChangeDecorations(event: (tree: Tree) => Map<string, TreeDecoration.Data>): void;
|
|
25
|
+
}
|
|
26
26
|
//# sourceMappingURL=scm-navigator-decorator.d.ts.map
|
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2019 Red Hat, Inc. 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-only 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 __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.ScmNavigatorDecorator = void 0;
|
|
31
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
32
|
-
const logger_1 = require("@theia/core/lib/common/logger");
|
|
33
|
-
const event_1 = require("@theia/core/lib/common/event");
|
|
34
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
35
|
-
const browser_2 = require("@theia/filesystem/lib/browser");
|
|
36
|
-
const uri_1 = require("@theia/core/lib/common/uri");
|
|
37
|
-
const color_registry_1 = require("@theia/core/lib/browser/color-registry");
|
|
38
|
-
const decorations_service_1 = require("@theia/core/lib/browser/decorations-service");
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated since 1.25.0
|
|
41
|
-
* URI-based decorators should implement `DecorationsProvider` and contribute decorations via the `DecorationsService`.
|
|
42
|
-
*/
|
|
43
|
-
let ScmNavigatorDecorator = class ScmNavigatorDecorator {
|
|
44
|
-
constructor(decorationsService) {
|
|
45
|
-
this.decorationsService = decorationsService;
|
|
46
|
-
this.id = 'theia-scm-decorator';
|
|
47
|
-
this.emitter = new event_1.Emitter();
|
|
48
|
-
this.decorationsService.onDidChangeDecorations(data => {
|
|
49
|
-
this.decorationsMap = data;
|
|
50
|
-
this.fireDidChangeDecorations((tree) => this.collectDecorators(tree));
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
collectDecorators(tree) {
|
|
54
|
-
const result = new Map();
|
|
55
|
-
if (tree.root === undefined || !this.decorationsMap) {
|
|
56
|
-
return result;
|
|
57
|
-
}
|
|
58
|
-
const markers = this.appendContainerChanges(this.decorationsMap);
|
|
59
|
-
for (const treeNode of new browser_1.DepthFirstTreeIterator(tree.root)) {
|
|
60
|
-
const uri = browser_2.FileStatNode.getUri(treeNode);
|
|
61
|
-
if (uri) {
|
|
62
|
-
const marker = markers.get(uri);
|
|
63
|
-
if (marker) {
|
|
64
|
-
result.set(treeNode.id, marker);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return new Map(Array.from(result.entries()).map(m => [m[0], this.toDecorator(m[1])]));
|
|
69
|
-
}
|
|
70
|
-
toDecorator(change) {
|
|
71
|
-
const colorVariable = change.colorId && this.colors.toCssVariableName(change.colorId);
|
|
72
|
-
return {
|
|
73
|
-
tailDecorations: [
|
|
74
|
-
{
|
|
75
|
-
data: change.letter ? change.letter : '',
|
|
76
|
-
fontData: {
|
|
77
|
-
color: colorVariable && `var(${colorVariable})`
|
|
78
|
-
},
|
|
79
|
-
tooltip: change.tooltip ? change.tooltip : ''
|
|
80
|
-
}
|
|
81
|
-
]
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
async decorations(tree) {
|
|
85
|
-
if (this.decorationsMap) {
|
|
86
|
-
return this.collectDecorators(tree);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
return new Map();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
appendContainerChanges(decorationsMap) {
|
|
93
|
-
const result = new Map();
|
|
94
|
-
for (const [uri, data] of decorationsMap.entries()) {
|
|
95
|
-
const uriString = uri.toString();
|
|
96
|
-
result.set(uriString, data);
|
|
97
|
-
let parentUri = new uri_1.default(uri).parent;
|
|
98
|
-
while (parentUri && !parentUri.path.isRoot) {
|
|
99
|
-
const parentUriString = parentUri.toString();
|
|
100
|
-
const existing = result.get(parentUriString);
|
|
101
|
-
if (existing === undefined) {
|
|
102
|
-
result.set(parentUriString, data);
|
|
103
|
-
parentUri = parentUri.parent;
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
parentUri = undefined;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return result;
|
|
111
|
-
}
|
|
112
|
-
get onDidChangeDecorations() {
|
|
113
|
-
return this.emitter.event;
|
|
114
|
-
}
|
|
115
|
-
fireDidChangeDecorations(event) {
|
|
116
|
-
this.emitter.fire(event);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
__decorate([
|
|
120
|
-
(0, inversify_1.inject)(logger_1.ILogger),
|
|
121
|
-
__metadata("design:type", Object)
|
|
122
|
-
], ScmNavigatorDecorator.prototype, "logger", void 0);
|
|
123
|
-
__decorate([
|
|
124
|
-
(0, inversify_1.inject)(color_registry_1.ColorRegistry),
|
|
125
|
-
__metadata("design:type", color_registry_1.ColorRegistry)
|
|
126
|
-
], ScmNavigatorDecorator.prototype, "colors", void 0);
|
|
127
|
-
ScmNavigatorDecorator = __decorate([
|
|
128
|
-
(0, inversify_1.injectable)(),
|
|
129
|
-
__param(0, (0, inversify_1.inject)(decorations_service_1.DecorationsService)),
|
|
130
|
-
__metadata("design:paramtypes", [Object])
|
|
131
|
-
], ScmNavigatorDecorator);
|
|
132
|
-
exports.ScmNavigatorDecorator = ScmNavigatorDecorator;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2019 Red Hat, Inc. 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-only 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 __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.ScmNavigatorDecorator = void 0;
|
|
31
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
32
|
+
const logger_1 = require("@theia/core/lib/common/logger");
|
|
33
|
+
const event_1 = require("@theia/core/lib/common/event");
|
|
34
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
35
|
+
const browser_2 = require("@theia/filesystem/lib/browser");
|
|
36
|
+
const uri_1 = require("@theia/core/lib/common/uri");
|
|
37
|
+
const color_registry_1 = require("@theia/core/lib/browser/color-registry");
|
|
38
|
+
const decorations_service_1 = require("@theia/core/lib/browser/decorations-service");
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated since 1.25.0
|
|
41
|
+
* URI-based decorators should implement `DecorationsProvider` and contribute decorations via the `DecorationsService`.
|
|
42
|
+
*/
|
|
43
|
+
let ScmNavigatorDecorator = class ScmNavigatorDecorator {
|
|
44
|
+
constructor(decorationsService) {
|
|
45
|
+
this.decorationsService = decorationsService;
|
|
46
|
+
this.id = 'theia-scm-decorator';
|
|
47
|
+
this.emitter = new event_1.Emitter();
|
|
48
|
+
this.decorationsService.onDidChangeDecorations(data => {
|
|
49
|
+
this.decorationsMap = data;
|
|
50
|
+
this.fireDidChangeDecorations((tree) => this.collectDecorators(tree));
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
collectDecorators(tree) {
|
|
54
|
+
const result = new Map();
|
|
55
|
+
if (tree.root === undefined || !this.decorationsMap) {
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
const markers = this.appendContainerChanges(this.decorationsMap);
|
|
59
|
+
for (const treeNode of new browser_1.DepthFirstTreeIterator(tree.root)) {
|
|
60
|
+
const uri = browser_2.FileStatNode.getUri(treeNode);
|
|
61
|
+
if (uri) {
|
|
62
|
+
const marker = markers.get(uri);
|
|
63
|
+
if (marker) {
|
|
64
|
+
result.set(treeNode.id, marker);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return new Map(Array.from(result.entries()).map(m => [m[0], this.toDecorator(m[1])]));
|
|
69
|
+
}
|
|
70
|
+
toDecorator(change) {
|
|
71
|
+
const colorVariable = change.colorId && this.colors.toCssVariableName(change.colorId);
|
|
72
|
+
return {
|
|
73
|
+
tailDecorations: [
|
|
74
|
+
{
|
|
75
|
+
data: change.letter ? change.letter : '',
|
|
76
|
+
fontData: {
|
|
77
|
+
color: colorVariable && `var(${colorVariable})`
|
|
78
|
+
},
|
|
79
|
+
tooltip: change.tooltip ? change.tooltip : ''
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
async decorations(tree) {
|
|
85
|
+
if (this.decorationsMap) {
|
|
86
|
+
return this.collectDecorators(tree);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return new Map();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
appendContainerChanges(decorationsMap) {
|
|
93
|
+
const result = new Map();
|
|
94
|
+
for (const [uri, data] of decorationsMap.entries()) {
|
|
95
|
+
const uriString = uri.toString();
|
|
96
|
+
result.set(uriString, data);
|
|
97
|
+
let parentUri = new uri_1.default(uri).parent;
|
|
98
|
+
while (parentUri && !parentUri.path.isRoot) {
|
|
99
|
+
const parentUriString = parentUri.toString();
|
|
100
|
+
const existing = result.get(parentUriString);
|
|
101
|
+
if (existing === undefined) {
|
|
102
|
+
result.set(parentUriString, data);
|
|
103
|
+
parentUri = parentUri.parent;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
parentUri = undefined;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
get onDidChangeDecorations() {
|
|
113
|
+
return this.emitter.event;
|
|
114
|
+
}
|
|
115
|
+
fireDidChangeDecorations(event) {
|
|
116
|
+
this.emitter.fire(event);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
__decorate([
|
|
120
|
+
(0, inversify_1.inject)(logger_1.ILogger),
|
|
121
|
+
__metadata("design:type", Object)
|
|
122
|
+
], ScmNavigatorDecorator.prototype, "logger", void 0);
|
|
123
|
+
__decorate([
|
|
124
|
+
(0, inversify_1.inject)(color_registry_1.ColorRegistry),
|
|
125
|
+
__metadata("design:type", color_registry_1.ColorRegistry)
|
|
126
|
+
], ScmNavigatorDecorator.prototype, "colors", void 0);
|
|
127
|
+
ScmNavigatorDecorator = __decorate([
|
|
128
|
+
(0, inversify_1.injectable)(),
|
|
129
|
+
__param(0, (0, inversify_1.inject)(decorations_service_1.DecorationsService)),
|
|
130
|
+
__metadata("design:paramtypes", [Object])
|
|
131
|
+
], ScmNavigatorDecorator);
|
|
132
|
+
exports.ScmNavigatorDecorator = ScmNavigatorDecorator;
|
|
133
133
|
//# sourceMappingURL=scm-navigator-decorator.js.map
|