@codingame/monaco-vscode-api 1.85.1 → 1.85.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/README.md +18 -5
- package/missing-services.js +324 -64
- package/monaco-editor-treemending.patch +946 -946
- package/package.json +8 -7
- package/service-override/tools/editor.js +1 -1
- package/services.js +10 -6
- package/vscode/src/vs/base/browser/ui/tree/treeDefaults.js +14 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionEnablementService.js +140 -0
- package/vscode/src/vs/platform/extensions/common/extensions.d.ts +1062 -93
- package/vscode/src/vs/platform/files/common/inMemoryFilesystemProvider.js +220 -0
- package/vscode/src/vs/platform/quickinput/browser/quickPickPin.js +102 -0
- package/vscode/src/vs/platform/userDataSync/common/content.js +9 -0
- package/vscode/src/vs/platform/userDataSync/common/settingsMerge.js +514 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSync.js +154 -2
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncAccount.js +43 -1
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncMachines.js +177 -0
- package/vscode/src/vs/platform/workspace/common/virtualWorkspace.js +4 -1
- package/vscode/src/vs/workbench/api/common/extHostApiCommands.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostWebview.js +2 -2
- package/vscode/src/vs/workbench/browser/parts/views/checkbox.js +105 -0
- package/vscode/src/vs/workbench/browser/parts/views/media/views.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/views/treeView.js +1614 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint.js +7 -7
- package/vscode/src/vs/workbench/contrib/files/browser/explorerViewlet.js +73 -2
- package/vscode/src/vs/workbench/contrib/tasks/common/taskDefinitionRegistry.js +6 -6
- package/vscode/src/vs/workbench/contrib/tasks/common/taskService.js +12 -2
- package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +712 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.js +130 -0
- package/vscode/src/vs/workbench/contrib/timeline/common/timeline.js +2 -1
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationService.js +20 -1
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverSchema.js +205 -0
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverUtils.js +11 -0
- package/vscode/src/vs/workbench/services/configurationResolver/common/variableResolver.js +9 -9
- package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionBisect.js +1 -1
- package/vscode/src/vs/workbench/services/keybinding/common/keybindingEditing.js +2 -2
- package/vscode/src/vs/workbench/services/languageStatus/common/languageStatusService.js +24 -1
- package/vscode/src/vs/workbench/services/preferences/browser/keybindingsEditorInput.js +41 -0
- package/vscode/src/vs/workbench/services/preferences/browser/keybindingsEditorModel.js +588 -0
- package/vscode/src/vs/workbench/services/preferences/common/preferencesEditorInput.js +43 -0
- package/vscode/src/vs/workbench/services/search/common/search.js +3 -3
- package/vscode/src/vs/workbench/services/terminal/common/embedderTerminalService.js +75 -1
- package/vscode/src/vs/workbench/services/timer/browser/timerService.js +240 -1
- package/vscode/src/vs/workbench/services/userData/browser/userDataInit.js +31 -1
- package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfile.js +25 -1
- package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfileIcons.js +75 -1
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSync.js +74 -4
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.js +708 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/workingCopyHistory.js +4 -0
- package/vscode/src/vs/base/parts/request/browser/request.js +0 -60
- package/vscode/src/vs/platform/request/browser/requestService.js +0 -28
- package/vscode/src/vs/platform/request/common/requestIpc.js +0 -17
- package/vscode/src/vs/platform/url/common/urlService.js +0 -17
- package/vscode/src/vs/workbench/services/configuration/common/jsonEditingService.js +0 -120
- package/vscode/src/vs/workbench/services/decorations/browser/decorationsService.js +0 -319
- package/vscode/src/vs/workbench/services/files/browser/elevatedFileService.js +0 -9
- package/vscode/src/vs/workbench/services/host/browser/browserHostService.js +0 -408
- package/vscode/src/vs/workbench/services/request/browser/requestService.js +0 -48
- package/vscode/src/vs/workbench/services/textfile/browser/browserTextFileService.js +0 -56
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +0 -639
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.js +0 -402
- package/vscode/src/vs/workbench/services/textfile/common/textFileSaveParticipant.js +0 -62
- package/vscode/src/vs/workbench/services/themes/browser/browserHostColorSchemeService.js +0 -38
- package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +0 -295
- package/vscode/src/vs/workbench/services/url/browser/urlService.js +0 -47
- package/vscode/src/vs/workbench/services/views/common/treeViewsService.js +0 -20
- package/vscode/src/vs/workbench/services/workspaces/common/canonicalUriService.js +0 -19
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createDecorator } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
2
|
+
const IWorkingCopyHistoryService = ( createDecorator('workingCopyHistoryService'));
|
|
3
|
+
const MAX_PARALLEL_HISTORY_IO_OPS = 20;
|
|
4
|
+
export { IWorkingCopyHistoryService, MAX_PARALLEL_HISTORY_IO_OPS };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { bufferToStream, VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
2
|
-
import { canceled } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
3
|
-
import { OfflineError } from '../common/request.js';
|
|
4
|
-
function request(options, token) {
|
|
5
|
-
if (options.proxyAuthorization) {
|
|
6
|
-
options.headers = {
|
|
7
|
-
...(options.headers || {}),
|
|
8
|
-
'Proxy-Authorization': options.proxyAuthorization
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
const xhr = ( new XMLHttpRequest());
|
|
12
|
-
return ( new Promise((resolve, reject) => {
|
|
13
|
-
xhr.open(options.type || 'GET', options.url || '', true, options.user, options.password);
|
|
14
|
-
setRequestHeaders(xhr, options);
|
|
15
|
-
xhr.responseType = 'arraybuffer';
|
|
16
|
-
xhr.onerror = e => reject(navigator.onLine ? ( new Error(xhr.statusText && ('XHR failed: ' + xhr.statusText) || 'XHR failed')) : ( new OfflineError()));
|
|
17
|
-
xhr.onload = (e) => {
|
|
18
|
-
resolve({
|
|
19
|
-
res: {
|
|
20
|
-
statusCode: xhr.status,
|
|
21
|
-
headers: getResponseHeaders(xhr)
|
|
22
|
-
},
|
|
23
|
-
stream: bufferToStream(VSBuffer.wrap(( new Uint8Array(xhr.response))))
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
xhr.ontimeout = e => reject(( new Error(`XHR timeout: ${options.timeout}ms`)));
|
|
27
|
-
if (options.timeout) {
|
|
28
|
-
xhr.timeout = options.timeout;
|
|
29
|
-
}
|
|
30
|
-
xhr.send(options.data);
|
|
31
|
-
token.onCancellationRequested(() => {
|
|
32
|
-
xhr.abort();
|
|
33
|
-
reject(canceled());
|
|
34
|
-
});
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
|
-
function setRequestHeaders(xhr, options) {
|
|
38
|
-
if (options.headers) {
|
|
39
|
-
outer: for (const k in options.headers) {
|
|
40
|
-
switch (k) {
|
|
41
|
-
case 'User-Agent':
|
|
42
|
-
case 'Accept-Encoding':
|
|
43
|
-
case 'Content-Length':
|
|
44
|
-
continue outer;
|
|
45
|
-
}
|
|
46
|
-
xhr.setRequestHeader(k, options.headers[k]);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function getResponseHeaders(xhr) {
|
|
51
|
-
const headers = Object.create(null);
|
|
52
|
-
for (const line of xhr.getAllResponseHeaders().split(/\r\n|\n|\r/g)) {
|
|
53
|
-
if (line) {
|
|
54
|
-
const idx = line.indexOf(':');
|
|
55
|
-
headers[line.substr(0, idx).trim().toLowerCase()] = line.substr(idx + 1).trim();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return headers;
|
|
59
|
-
}
|
|
60
|
-
export { request };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { request } from '../../../base/parts/request/browser/request.js';
|
|
3
|
-
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
4
|
-
import { ILoggerService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
5
|
-
import { AbstractRequestService } from '../common/request.js';
|
|
6
|
-
let RequestService = class RequestService extends AbstractRequestService {
|
|
7
|
-
constructor(configurationService, loggerService) {
|
|
8
|
-
super(loggerService);
|
|
9
|
-
this.configurationService = configurationService;
|
|
10
|
-
}
|
|
11
|
-
async request(options, token) {
|
|
12
|
-
if (!options.proxyAuthorization) {
|
|
13
|
-
options.proxyAuthorization = this.configurationService.getValue('http.proxyAuthorization');
|
|
14
|
-
}
|
|
15
|
-
return this.logAndRequest('browser', options, () => request(options, token));
|
|
16
|
-
}
|
|
17
|
-
async resolveProxy(url) {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
async loadCertificates() {
|
|
21
|
-
return [];
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
RequestService = ( __decorate([
|
|
25
|
-
( __param(0, IConfigurationService)),
|
|
26
|
-
( __param(1, ILoggerService))
|
|
27
|
-
], RequestService));
|
|
28
|
-
export { RequestService };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { bufferToStream } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
2
|
-
class RequestChannelClient {
|
|
3
|
-
constructor(channel) {
|
|
4
|
-
this.channel = channel;
|
|
5
|
-
}
|
|
6
|
-
async request(options, token) {
|
|
7
|
-
const [res, buffer] = await this.channel.call('request', [options], token);
|
|
8
|
-
return { res, stream: bufferToStream(buffer) };
|
|
9
|
-
}
|
|
10
|
-
async resolveProxy(url) {
|
|
11
|
-
return this.channel.call('resolveProxy', [url]);
|
|
12
|
-
}
|
|
13
|
-
async loadCertificates() {
|
|
14
|
-
return this.channel.call('loadCertificates');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export { RequestChannelClient };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { first } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
2
|
-
import { Disposable, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
-
class AbstractURLService extends Disposable {
|
|
4
|
-
constructor() {
|
|
5
|
-
super(...arguments);
|
|
6
|
-
this.handlers = ( new Set());
|
|
7
|
-
}
|
|
8
|
-
open(uri, options) {
|
|
9
|
-
const handlers = [...( this.handlers.values())];
|
|
10
|
-
return first(( handlers.map(h => () => h.handleURL(uri, options))), undefined, false).then(val => val || false);
|
|
11
|
-
}
|
|
12
|
-
registerHandler(handler) {
|
|
13
|
-
this.handlers.add(handler);
|
|
14
|
-
return toDisposable(() => this.handlers.delete(handler));
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export { AbstractURLService };
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
3
|
-
import * as json from 'monaco-editor/esm/vs/base/common/json.js';
|
|
4
|
-
import { setProperty } from '../../../../base/common/jsonEdit.js';
|
|
5
|
-
import { Queue } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
6
|
-
import { EditOperation } from 'monaco-editor/esm/vs/editor/common/core/editOperation.js';
|
|
7
|
-
import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
|
|
8
|
-
import { Selection } from 'monaco-editor/esm/vs/editor/common/core/selection.js';
|
|
9
|
-
import { ITextFileService } from '../../textfile/common/textfiles.js';
|
|
10
|
-
import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
11
|
-
import { ITextModelService } from 'monaco-editor/esm/vs/editor/common/services/resolverService.js';
|
|
12
|
-
import { JSONEditingError } from './jsonEditing.js';
|
|
13
|
-
let JSONEditingService = class JSONEditingService {
|
|
14
|
-
constructor(fileService, textModelResolverService, textFileService) {
|
|
15
|
-
this.fileService = fileService;
|
|
16
|
-
this.textModelResolverService = textModelResolverService;
|
|
17
|
-
this.textFileService = textFileService;
|
|
18
|
-
this.queue = ( new Queue());
|
|
19
|
-
}
|
|
20
|
-
write(resource, values) {
|
|
21
|
-
return Promise.resolve(this.queue.queue(() => this.doWriteConfiguration(resource, values)));
|
|
22
|
-
}
|
|
23
|
-
async doWriteConfiguration(resource, values) {
|
|
24
|
-
const reference = await this.resolveAndValidate(resource, true);
|
|
25
|
-
try {
|
|
26
|
-
await this.writeToBuffer(reference.object.textEditorModel, values);
|
|
27
|
-
}
|
|
28
|
-
finally {
|
|
29
|
-
reference.dispose();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
async writeToBuffer(model, values) {
|
|
33
|
-
let hasEdits = false;
|
|
34
|
-
for (const value of values) {
|
|
35
|
-
const edit = this.getEdits(model, value)[0];
|
|
36
|
-
hasEdits = !!edit && this.applyEditsToBuffer(edit, model);
|
|
37
|
-
}
|
|
38
|
-
if (hasEdits) {
|
|
39
|
-
return this.textFileService.save(model.uri);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
applyEditsToBuffer(edit, model) {
|
|
43
|
-
const startPosition = model.getPositionAt(edit.offset);
|
|
44
|
-
const endPosition = model.getPositionAt(edit.offset + edit.length);
|
|
45
|
-
const range = ( new Range(
|
|
46
|
-
startPosition.lineNumber,
|
|
47
|
-
startPosition.column,
|
|
48
|
-
endPosition.lineNumber,
|
|
49
|
-
endPosition.column
|
|
50
|
-
));
|
|
51
|
-
const currentText = model.getValueInRange(range);
|
|
52
|
-
if (edit.content !== currentText) {
|
|
53
|
-
const editOperation = currentText ? EditOperation.replace(range, edit.content) : EditOperation.insert(startPosition, edit.content);
|
|
54
|
-
model.pushEditOperations([( new Selection(
|
|
55
|
-
startPosition.lineNumber,
|
|
56
|
-
startPosition.column,
|
|
57
|
-
startPosition.lineNumber,
|
|
58
|
-
startPosition.column
|
|
59
|
-
))], [editOperation], () => []);
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
getEdits(model, configurationValue) {
|
|
65
|
-
const { tabSize, insertSpaces } = model.getOptions();
|
|
66
|
-
const eol = model.getEOL();
|
|
67
|
-
const { path, value } = configurationValue;
|
|
68
|
-
if (!path.length) {
|
|
69
|
-
const content = JSON.stringify(value, null, insertSpaces ? ' '.repeat(tabSize) : '\t');
|
|
70
|
-
return [{
|
|
71
|
-
content,
|
|
72
|
-
length: content.length,
|
|
73
|
-
offset: 0
|
|
74
|
-
}];
|
|
75
|
-
}
|
|
76
|
-
return setProperty(model.getValue(), path, value, { tabSize, insertSpaces, eol });
|
|
77
|
-
}
|
|
78
|
-
async resolveModelReference(resource) {
|
|
79
|
-
const exists = await this.fileService.exists(resource);
|
|
80
|
-
if (!exists) {
|
|
81
|
-
await this.textFileService.write(resource, '{}', { encoding: 'utf8' });
|
|
82
|
-
}
|
|
83
|
-
return this.textModelResolverService.createModelReference(resource);
|
|
84
|
-
}
|
|
85
|
-
hasParseErrors(model) {
|
|
86
|
-
const parseErrors = [];
|
|
87
|
-
json.parse(model.getValue(), parseErrors, { allowTrailingComma: true, allowEmptyContent: true });
|
|
88
|
-
return parseErrors.length > 0;
|
|
89
|
-
}
|
|
90
|
-
async resolveAndValidate(resource, checkDirty) {
|
|
91
|
-
const reference = await this.resolveModelReference(resource);
|
|
92
|
-
const model = reference.object.textEditorModel;
|
|
93
|
-
if (this.hasParseErrors(model)) {
|
|
94
|
-
reference.dispose();
|
|
95
|
-
return this.reject(0 );
|
|
96
|
-
}
|
|
97
|
-
return reference;
|
|
98
|
-
}
|
|
99
|
-
reject(code) {
|
|
100
|
-
const message = this.toErrorMessage(code);
|
|
101
|
-
return Promise.reject(( new JSONEditingError(message, code)));
|
|
102
|
-
}
|
|
103
|
-
toErrorMessage(error) {
|
|
104
|
-
switch (error) {
|
|
105
|
-
case 0 : {
|
|
106
|
-
return ( nls.localizeWithPath(
|
|
107
|
-
'vs/workbench/services/configuration/common/jsonEditingService',
|
|
108
|
-
'errorInvalidFile',
|
|
109
|
-
"Unable to write into the file. Please open the file to correct errors/warnings in the file and try again."
|
|
110
|
-
));
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
JSONEditingService = ( __decorate([
|
|
116
|
-
( __param(0, IFileService)),
|
|
117
|
-
( __param(1, ITextModelService)),
|
|
118
|
-
( __param(2, ITextFileService))
|
|
119
|
-
], JSONEditingService));
|
|
120
|
-
export { JSONEditingService };
|
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { DebounceEmitter, Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
3
|
-
import { TernarySearchTree } from 'monaco-editor/esm/vs/base/common/ternarySearchTree.js';
|
|
4
|
-
import { toDisposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
-
import { isThenable } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
6
|
-
import { LinkedList } from 'monaco-editor/esm/vs/base/common/linkedList.js';
|
|
7
|
-
import { createCSSRule, asCSSPropertyValue, removeCSSRulesContainingSelector, createStyleSheet } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
8
|
-
import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
9
|
-
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
10
|
-
import { isFalsyOrWhitespace } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
11
|
-
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
12
|
-
import { isCancellationError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
13
|
-
import { CancellationTokenSource } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
14
|
-
import { hash } from 'monaco-editor/esm/vs/base/common/hash.js';
|
|
15
|
-
import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
|
|
16
|
-
import { distinct, asArray } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
17
|
-
import { asCssVariable } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
|
|
18
|
-
import { getIconRegistry } from 'monaco-editor/esm/vs/platform/theme/common/iconRegistry.js';
|
|
19
|
-
class DecorationRule {
|
|
20
|
-
static keyOf(data) {
|
|
21
|
-
if (Array.isArray(data)) {
|
|
22
|
-
return ( data.map(DecorationRule.keyOf)).join(',');
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
const { color, letter } = data;
|
|
26
|
-
if (ThemeIcon.isThemeIcon(letter)) {
|
|
27
|
-
return `${color}+${letter.id}`;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
return `${color}/${letter}`;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
static { this._classNamesPrefix = 'monaco-decoration'; }
|
|
35
|
-
constructor(themeService, data, key) {
|
|
36
|
-
this.themeService = themeService;
|
|
37
|
-
this._refCounter = 0;
|
|
38
|
-
this.data = data;
|
|
39
|
-
const suffix = ( hash(key).toString(36));
|
|
40
|
-
this.itemColorClassName = `${DecorationRule._classNamesPrefix}-itemColor-${suffix}`;
|
|
41
|
-
this.itemBadgeClassName = `${DecorationRule._classNamesPrefix}-itemBadge-${suffix}`;
|
|
42
|
-
this.bubbleBadgeClassName = `${DecorationRule._classNamesPrefix}-bubbleBadge-${suffix}`;
|
|
43
|
-
this.iconBadgeClassName = `${DecorationRule._classNamesPrefix}-iconBadge-${suffix}`;
|
|
44
|
-
}
|
|
45
|
-
acquire() {
|
|
46
|
-
this._refCounter += 1;
|
|
47
|
-
}
|
|
48
|
-
release() {
|
|
49
|
-
return --this._refCounter === 0;
|
|
50
|
-
}
|
|
51
|
-
appendCSSRules(element) {
|
|
52
|
-
if (!Array.isArray(this.data)) {
|
|
53
|
-
this._appendForOne(this.data, element);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
this._appendForMany(this.data, element);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
_appendForOne(data, element) {
|
|
60
|
-
const { color, letter } = data;
|
|
61
|
-
createCSSRule(`.${this.itemColorClassName}`, `color: ${getColor(color)};`, element);
|
|
62
|
-
if (ThemeIcon.isThemeIcon(letter)) {
|
|
63
|
-
this._createIconCSSRule(letter, color, element);
|
|
64
|
-
}
|
|
65
|
-
else if (letter) {
|
|
66
|
-
createCSSRule(`.${this.itemBadgeClassName}::after`, `content: "${letter}"; color: ${getColor(color)};`, element);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
_appendForMany(data, element) {
|
|
70
|
-
const { color } = data[0];
|
|
71
|
-
createCSSRule(`.${this.itemColorClassName}`, `color: ${getColor(color)};`, element);
|
|
72
|
-
const letters = [];
|
|
73
|
-
let icon;
|
|
74
|
-
for (const d of data) {
|
|
75
|
-
if (ThemeIcon.isThemeIcon(d.letter)) {
|
|
76
|
-
icon = d.letter;
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
else if (d.letter) {
|
|
80
|
-
letters.push(d.letter);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (icon) {
|
|
84
|
-
this._createIconCSSRule(icon, color, element);
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
if (letters.length) {
|
|
88
|
-
createCSSRule(`.${this.itemBadgeClassName}::after`, `content: "${letters.join(', ')}"; color: ${getColor(color)};`, element);
|
|
89
|
-
}
|
|
90
|
-
createCSSRule(`.${this.bubbleBadgeClassName}::after`, `content: "\uea71"; color: ${getColor(color)}; font-family: codicon; font-size: 14px; margin-right: 14px; opacity: 0.4;`, element);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
_createIconCSSRule(icon, color, element) {
|
|
94
|
-
const modifier = ThemeIcon.getModifier(icon);
|
|
95
|
-
if (modifier) {
|
|
96
|
-
icon = ThemeIcon.modify(icon, undefined);
|
|
97
|
-
}
|
|
98
|
-
const iconContribution = getIconRegistry().getIcon(icon.id);
|
|
99
|
-
if (!iconContribution) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const definition = this.themeService.getProductIconTheme().getIcon(iconContribution);
|
|
103
|
-
if (!definition) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
createCSSRule(`.${this.iconBadgeClassName}::after`, `content: '${definition.fontCharacter}';
|
|
107
|
-
color: ${icon.color ? getColor(icon.color.id) : getColor(color)};
|
|
108
|
-
font-family: ${asCSSPropertyValue(definition.font?.id ?? 'codicon')};
|
|
109
|
-
font-size: 16px;
|
|
110
|
-
margin-right: 14px;
|
|
111
|
-
font-weight: normal;
|
|
112
|
-
${modifier === 'spin' ? 'animation: codicon-spin 1.5s steps(30) infinite' : ''};
|
|
113
|
-
`, element);
|
|
114
|
-
}
|
|
115
|
-
removeCSSRules(element) {
|
|
116
|
-
removeCSSRulesContainingSelector(this.itemColorClassName, element);
|
|
117
|
-
removeCSSRulesContainingSelector(this.itemBadgeClassName, element);
|
|
118
|
-
removeCSSRulesContainingSelector(this.bubbleBadgeClassName, element);
|
|
119
|
-
removeCSSRulesContainingSelector(this.iconBadgeClassName, element);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
class DecorationStyles {
|
|
123
|
-
constructor(_themeService) {
|
|
124
|
-
this._themeService = _themeService;
|
|
125
|
-
this._dispoables = ( new DisposableStore());
|
|
126
|
-
this._styleElement = createStyleSheet(undefined, undefined, this._dispoables);
|
|
127
|
-
this._decorationRules = ( new Map());
|
|
128
|
-
}
|
|
129
|
-
dispose() {
|
|
130
|
-
this._dispoables.dispose();
|
|
131
|
-
}
|
|
132
|
-
asDecoration(data, onlyChildren) {
|
|
133
|
-
data.sort((a, b) => (b.weight || 0) - (a.weight || 0));
|
|
134
|
-
const key = DecorationRule.keyOf(data);
|
|
135
|
-
let rule = this._decorationRules.get(key);
|
|
136
|
-
if (!rule) {
|
|
137
|
-
rule = ( new DecorationRule(this._themeService, data, key));
|
|
138
|
-
this._decorationRules.set(key, rule);
|
|
139
|
-
rule.appendCSSRules(this._styleElement);
|
|
140
|
-
}
|
|
141
|
-
rule.acquire();
|
|
142
|
-
const labelClassName = rule.itemColorClassName;
|
|
143
|
-
let badgeClassName = rule.itemBadgeClassName;
|
|
144
|
-
const iconClassName = rule.iconBadgeClassName;
|
|
145
|
-
let tooltip = distinct(( data.filter(d => !isFalsyOrWhitespace(d.tooltip)).map(d => d.tooltip))).join(' • ');
|
|
146
|
-
const strikethrough = ( data.some(d => d.strikethrough));
|
|
147
|
-
if (onlyChildren) {
|
|
148
|
-
badgeClassName = rule.bubbleBadgeClassName;
|
|
149
|
-
tooltip = ( localizeWithPath(
|
|
150
|
-
'vs/workbench/services/decorations/browser/decorationsService',
|
|
151
|
-
'bubbleTitle',
|
|
152
|
-
"Contains emphasized items"
|
|
153
|
-
));
|
|
154
|
-
}
|
|
155
|
-
return {
|
|
156
|
-
labelClassName,
|
|
157
|
-
badgeClassName,
|
|
158
|
-
iconClassName,
|
|
159
|
-
strikethrough,
|
|
160
|
-
tooltip,
|
|
161
|
-
dispose: () => {
|
|
162
|
-
if (rule?.release()) {
|
|
163
|
-
this._decorationRules.delete(key);
|
|
164
|
-
rule.removeCSSRules(this._styleElement);
|
|
165
|
-
rule = undefined;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
class FileDecorationChangeEvent {
|
|
172
|
-
constructor(all) {
|
|
173
|
-
this._data = TernarySearchTree.forUris(_uri => true);
|
|
174
|
-
this._data.fill(true, asArray(all));
|
|
175
|
-
}
|
|
176
|
-
affectsResource(uri) {
|
|
177
|
-
return this._data.hasElementOrSubtree(uri);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
class DecorationDataRequest {
|
|
181
|
-
constructor(source, thenable) {
|
|
182
|
-
this.source = source;
|
|
183
|
-
this.thenable = thenable;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
function getColor(color) {
|
|
187
|
-
return color ? asCssVariable(color) : 'inherit';
|
|
188
|
-
}
|
|
189
|
-
let DecorationsService = class DecorationsService {
|
|
190
|
-
constructor(uriIdentityService, themeService) {
|
|
191
|
-
this._onDidChangeDecorationsDelayed = ( new DebounceEmitter({ merge: all => all.flat() }));
|
|
192
|
-
this._onDidChangeDecorations = ( new Emitter());
|
|
193
|
-
this.onDidChangeDecorations = this._onDidChangeDecorations.event;
|
|
194
|
-
this._provider = ( new LinkedList());
|
|
195
|
-
this._decorationStyles = ( new DecorationStyles(themeService));
|
|
196
|
-
this._data = TernarySearchTree.forUris(key => uriIdentityService.extUri.ignorePathCasing(key));
|
|
197
|
-
this._onDidChangeDecorationsDelayed.event(event => { this._onDidChangeDecorations.fire(( new FileDecorationChangeEvent(event))); });
|
|
198
|
-
}
|
|
199
|
-
dispose() {
|
|
200
|
-
this._onDidChangeDecorations.dispose();
|
|
201
|
-
this._onDidChangeDecorationsDelayed.dispose();
|
|
202
|
-
this._data.clear();
|
|
203
|
-
}
|
|
204
|
-
registerDecorationsProvider(provider) {
|
|
205
|
-
const rm = this._provider.unshift(provider);
|
|
206
|
-
this._onDidChangeDecorations.fire({
|
|
207
|
-
affectsResource() { return true; }
|
|
208
|
-
});
|
|
209
|
-
const removeAll = () => {
|
|
210
|
-
const uris = [];
|
|
211
|
-
for (const [uri, map] of this._data) {
|
|
212
|
-
if (map.delete(provider)) {
|
|
213
|
-
uris.push(uri);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
if (uris.length > 0) {
|
|
217
|
-
this._onDidChangeDecorationsDelayed.fire(uris);
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
const listener = provider.onDidChange(uris => {
|
|
221
|
-
if (!uris) {
|
|
222
|
-
removeAll();
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
for (const uri of uris) {
|
|
226
|
-
const map = this._ensureEntry(uri);
|
|
227
|
-
this._fetchData(map, uri, provider);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
return toDisposable(() => {
|
|
232
|
-
rm();
|
|
233
|
-
listener.dispose();
|
|
234
|
-
removeAll();
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
_ensureEntry(uri) {
|
|
238
|
-
let map = this._data.get(uri);
|
|
239
|
-
if (!map) {
|
|
240
|
-
map = ( new Map());
|
|
241
|
-
this._data.set(uri, map);
|
|
242
|
-
}
|
|
243
|
-
return map;
|
|
244
|
-
}
|
|
245
|
-
getDecoration(uri, includeChildren) {
|
|
246
|
-
const all = [];
|
|
247
|
-
let containsChildren = false;
|
|
248
|
-
const map = this._ensureEntry(uri);
|
|
249
|
-
for (const provider of this._provider) {
|
|
250
|
-
let data = map.get(provider);
|
|
251
|
-
if (data === undefined) {
|
|
252
|
-
data = this._fetchData(map, uri, provider);
|
|
253
|
-
}
|
|
254
|
-
if (data && !(data instanceof DecorationDataRequest)) {
|
|
255
|
-
all.push(data);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
if (includeChildren) {
|
|
259
|
-
const iter = this._data.findSuperstr(uri);
|
|
260
|
-
if (iter) {
|
|
261
|
-
for (const tuple of iter) {
|
|
262
|
-
for (const data of ( tuple[1].values())) {
|
|
263
|
-
if (data && !(data instanceof DecorationDataRequest)) {
|
|
264
|
-
if (data.bubble) {
|
|
265
|
-
all.push(data);
|
|
266
|
-
containsChildren = true;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
return all.length === 0
|
|
274
|
-
? undefined
|
|
275
|
-
: this._decorationStyles.asDecoration(all, containsChildren);
|
|
276
|
-
}
|
|
277
|
-
_fetchData(map, uri, provider) {
|
|
278
|
-
const pendingRequest = map.get(provider);
|
|
279
|
-
if (pendingRequest instanceof DecorationDataRequest) {
|
|
280
|
-
pendingRequest.source.cancel();
|
|
281
|
-
map.delete(provider);
|
|
282
|
-
}
|
|
283
|
-
const cts = ( new CancellationTokenSource());
|
|
284
|
-
const dataOrThenable = provider.provideDecorations(uri, cts.token);
|
|
285
|
-
if (!isThenable(dataOrThenable)) {
|
|
286
|
-
cts.dispose();
|
|
287
|
-
return this._keepItem(map, provider, uri, dataOrThenable);
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
const request = ( new DecorationDataRequest(cts, Promise.resolve(dataOrThenable).then(data => {
|
|
291
|
-
if (map.get(provider) === request) {
|
|
292
|
-
this._keepItem(map, provider, uri, data);
|
|
293
|
-
}
|
|
294
|
-
}).catch(err => {
|
|
295
|
-
if (!isCancellationError(err) && map.get(provider) === request) {
|
|
296
|
-
map.delete(provider);
|
|
297
|
-
}
|
|
298
|
-
}).finally(() => {
|
|
299
|
-
cts.dispose();
|
|
300
|
-
})));
|
|
301
|
-
map.set(provider, request);
|
|
302
|
-
return null;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
_keepItem(map, provider, uri, data) {
|
|
306
|
-
const deco = data ? data : null;
|
|
307
|
-
const old = map.get(provider);
|
|
308
|
-
map.set(provider, deco);
|
|
309
|
-
if (deco || old) {
|
|
310
|
-
this._onDidChangeDecorationsDelayed.fire(uri);
|
|
311
|
-
}
|
|
312
|
-
return deco;
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
DecorationsService = ( __decorate([
|
|
316
|
-
( __param(0, IUriIdentityService)),
|
|
317
|
-
( __param(1, IThemeService))
|
|
318
|
-
], DecorationsService));
|
|
319
|
-
export { DecorationsService };
|