@codingame/monaco-vscode-configuration-service-override 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,121 +0,0 @@
1
- import { equals } from 'vscode/vscode/vs/base/common/objects';
2
- import { toValuesTree } from 'vscode/vscode/vs/platform/configuration/common/configuration';
3
- import { Configuration as Configuration$1, ConfigurationModelParser, ConfigurationModel } from 'vscode/vscode/vs/platform/configuration/common/configurationModels';
4
- import { isBoolean } from 'vscode/vscode/vs/base/common/types';
5
- import { distinct } from 'vscode/vscode/vs/base/common/arrays';
6
-
7
- class WorkspaceConfigurationModelParser extends ConfigurationModelParser {
8
- constructor(name) {
9
- super(name);
10
- this._folders = [];
11
- this._transient = false;
12
- this._settingsModelParser = ( new ConfigurationModelParser(name));
13
- this._launchModel = ( new ConfigurationModel());
14
- this._tasksModel = ( new ConfigurationModel());
15
- }
16
- get folders() {
17
- return this._folders;
18
- }
19
- get transient() {
20
- return this._transient;
21
- }
22
- get settingsModel() {
23
- return this._settingsModelParser.configurationModel;
24
- }
25
- get launchModel() {
26
- return this._launchModel;
27
- }
28
- get tasksModel() {
29
- return this._tasksModel;
30
- }
31
- reparseWorkspaceSettings(configurationParseOptions) {
32
- this._settingsModelParser.reparse(configurationParseOptions);
33
- }
34
- getRestrictedWorkspaceSettings() {
35
- return this._settingsModelParser.restrictedConfigurations;
36
- }
37
- doParseRaw(raw, configurationParseOptions) {
38
- this._folders = (raw['folders'] || []);
39
- this._transient = isBoolean(raw['transient']) && raw['transient'];
40
- this._settingsModelParser.parseRaw(raw['settings'], configurationParseOptions);
41
- this._launchModel = this.createConfigurationModelFrom(raw, 'launch');
42
- this._tasksModel = this.createConfigurationModelFrom(raw, 'tasks');
43
- return super.doParseRaw(raw, configurationParseOptions);
44
- }
45
- createConfigurationModelFrom(raw, key) {
46
- const data = raw[key];
47
- if (data) {
48
- const contents = toValuesTree(data, message => console.error(`Conflict in settings file ${this._name}: ${message}`));
49
- const scopedContents = Object.create(null);
50
- scopedContents[key] = contents;
51
- const keys = ( ( Object.keys(data)).map(k => `${key}.${k}`));
52
- return ( new ConfigurationModel(scopedContents, keys, []));
53
- }
54
- return ( new ConfigurationModel());
55
- }
56
- }
57
- class StandaloneConfigurationModelParser extends ConfigurationModelParser {
58
- constructor(name, scope) {
59
- super(name);
60
- this.scope = scope;
61
- }
62
- doParseRaw(raw, configurationParseOptions) {
63
- const contents = toValuesTree(raw, message => console.error(`Conflict in settings file ${this._name}: ${message}`));
64
- const scopedContents = Object.create(null);
65
- scopedContents[this.scope] = contents;
66
- const keys = ( ( Object.keys(raw)).map(key => `${this.scope}.${key}`));
67
- return { contents: scopedContents, keys, overrides: [] };
68
- }
69
- }
70
- class Configuration extends Configuration$1 {
71
- constructor(defaults, policy, application, localUser, remoteUser, workspaceConfiguration, folders, memoryConfiguration, memoryConfigurationByResource, _workspace) {
72
- super(defaults, policy, application, localUser, remoteUser, workspaceConfiguration, folders, memoryConfiguration, memoryConfigurationByResource);
73
- this._workspace = _workspace;
74
- }
75
- getValue(key, overrides = {}) {
76
- return super.getValue(key, overrides, this._workspace);
77
- }
78
- inspect(key, overrides = {}) {
79
- return super.inspect(key, overrides, this._workspace);
80
- }
81
- keys() {
82
- return ( super.keys(this._workspace));
83
- }
84
- compareAndDeleteFolderConfiguration(folder) {
85
- if (this._workspace && this._workspace.folders.length > 0 && ( this._workspace.folders[0].uri.toString()) === ( folder.toString())) {
86
- return { keys: [], overrides: [] };
87
- }
88
- return super.compareAndDeleteFolderConfiguration(folder);
89
- }
90
- compare(other) {
91
- const compare = (fromKeys, toKeys, overrideIdentifier) => {
92
- const keys = [];
93
- keys.push(...toKeys.filter(key => fromKeys.indexOf(key) === -1));
94
- keys.push(...fromKeys.filter(key => toKeys.indexOf(key) === -1));
95
- keys.push(...fromKeys.filter(key => {
96
- if (toKeys.indexOf(key) === -1) {
97
- return false;
98
- }
99
- if (!equals(this.getValue(key, { overrideIdentifier }), other.getValue(key, { overrideIdentifier }))) {
100
- return true;
101
- }
102
- return this._workspace && ( this._workspace.folders.some(
103
- folder => !equals(this.getValue(key, { resource: folder.uri, overrideIdentifier }), other.getValue(key, { resource: folder.uri, overrideIdentifier }))
104
- ));
105
- }));
106
- return keys;
107
- };
108
- const keys = compare(this.allKeys(), other.allKeys());
109
- const overrides = [];
110
- const allOverrideIdentifiers = distinct([...this.allOverrideIdentifiers(), ...other.allOverrideIdentifiers()]);
111
- for (const overrideIdentifier of allOverrideIdentifiers) {
112
- const keys = compare(this.getAllKeysForOverrideIdentifier(overrideIdentifier), other.getAllKeysForOverrideIdentifier(overrideIdentifier), overrideIdentifier);
113
- if (keys.length) {
114
- overrides.push([overrideIdentifier, keys]);
115
- }
116
- }
117
- return { keys, overrides };
118
- }
119
- }
120
-
121
- export { Configuration, StandaloneConfigurationModelParser, WorkspaceConfigurationModelParser };
@@ -1,437 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
- import { URI } from 'vscode/vscode/vs/base/common/uri';
4
- import { dispose, Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
5
- import { sep, posix, win32 } from 'vscode/vscode/vs/base/common/path';
6
- import { Emitter } from 'vscode/vscode/vs/base/common/event';
7
- import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
8
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
9
- import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
10
- import { isWorkspace, toWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, isUntitledWorkspace, isTemporaryWorkspace, WORKSPACE_EXTENSION, IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
11
- import { basenameOrAuthority, basename, joinPath, dirname } from 'vscode/vscode/vs/base/common/resources';
12
- import { getPathLabel, tildify } from 'vscode/vscode/vs/base/common/labels';
13
- import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
14
- import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
15
- import { match } from 'vscode/vscode/vs/base/common/glob';
16
- import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
17
- import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
18
- import { isProposedApiEnabled } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
19
- import { OS } from 'vscode/vscode/vs/base/common/platform';
20
- import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService';
21
- import { Schemas } from 'vscode/vscode/vs/base/common/network';
22
- import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
23
- import { Memento } from 'vscode/vscode/vs/workbench/common/memento';
24
- import { firstOrDefault } from 'vscode/vscode/vs/base/common/arrays';
25
-
26
- const resourceLabelFormattersExtPoint = ExtensionsRegistry.registerExtensionPoint({
27
- extensionPoint: 'resourceLabelFormatters',
28
- jsonSchema: {
29
- description: ( localizeWithPath(
30
- 'vs/workbench/services/label/common/labelService',
31
- 'vscode.extension.contributes.resourceLabelFormatters',
32
- 'Contributes resource label formatting rules.'
33
- )),
34
- type: 'array',
35
- items: {
36
- type: 'object',
37
- required: ['scheme', 'formatting'],
38
- properties: {
39
- scheme: {
40
- type: 'string',
41
- description: ( localizeWithPath(
42
- 'vs/workbench/services/label/common/labelService',
43
- 'vscode.extension.contributes.resourceLabelFormatters.scheme',
44
- 'URI scheme on which to match the formatter on. For example "file". Simple glob patterns are supported.'
45
- )),
46
- },
47
- authority: {
48
- type: 'string',
49
- description: ( localizeWithPath(
50
- 'vs/workbench/services/label/common/labelService',
51
- 'vscode.extension.contributes.resourceLabelFormatters.authority',
52
- 'URI authority on which to match the formatter on. Simple glob patterns are supported.'
53
- )),
54
- },
55
- formatting: {
56
- description: ( localizeWithPath(
57
- 'vs/workbench/services/label/common/labelService',
58
- 'vscode.extension.contributes.resourceLabelFormatters.formatting',
59
- "Rules for formatting uri resource labels."
60
- )),
61
- type: 'object',
62
- properties: {
63
- label: {
64
- type: 'string',
65
- description: ( localizeWithPath(
66
- 'vs/workbench/services/label/common/labelService',
67
- 'vscode.extension.contributes.resourceLabelFormatters.label',
68
- "Label rules to display. For example: myLabel:/${path}. ${path}, ${scheme}, ${authority} and ${authoritySuffix} are supported as variables."
69
- ))
70
- },
71
- separator: {
72
- type: 'string',
73
- description: ( localizeWithPath(
74
- 'vs/workbench/services/label/common/labelService',
75
- 'vscode.extension.contributes.resourceLabelFormatters.separator',
76
- "Separator to be used in the uri label display. '/' or '\' as an example."
77
- ))
78
- },
79
- stripPathStartingSeparator: {
80
- type: 'boolean',
81
- description: ( localizeWithPath(
82
- 'vs/workbench/services/label/common/labelService',
83
- 'vscode.extension.contributes.resourceLabelFormatters.stripPathStartingSeparator',
84
- "Controls whether `${path}` substitutions should have starting separator characters stripped."
85
- ))
86
- },
87
- tildify: {
88
- type: 'boolean',
89
- description: ( localizeWithPath(
90
- 'vs/workbench/services/label/common/labelService',
91
- 'vscode.extension.contributes.resourceLabelFormatters.tildify',
92
- "Controls if the start of the uri label should be tildified when possible."
93
- ))
94
- },
95
- workspaceSuffix: {
96
- type: 'string',
97
- description: ( localizeWithPath(
98
- 'vs/workbench/services/label/common/labelService',
99
- 'vscode.extension.contributes.resourceLabelFormatters.formatting.workspaceSuffix',
100
- "Suffix appended to the workspace label."
101
- ))
102
- }
103
- }
104
- }
105
- }
106
- }
107
- }
108
- });
109
- const sepRegexp = /\//g;
110
- const labelMatchingRegexp = /\$\{(scheme|authoritySuffix|authority|path|(query)\.(.+?))\}/g;
111
- function hasDriveLetterIgnorePlatform(path) {
112
- return !!(path && path[2] === ':');
113
- }
114
- let ResourceLabelFormattersHandler = class ResourceLabelFormattersHandler {
115
- constructor(labelService) {
116
- this.formattersDisposables = ( new Map());
117
- resourceLabelFormattersExtPoint.setHandler((extensions, delta) => {
118
- for (const added of delta.added) {
119
- for (const untrustedFormatter of added.value) {
120
- const formatter = { ...untrustedFormatter };
121
- if (typeof formatter.formatting.label !== 'string') {
122
- formatter.formatting.label = '${authority}${path}';
123
- }
124
- if (typeof formatter.formatting.separator !== `string`) {
125
- formatter.formatting.separator = sep;
126
- }
127
- if (!isProposedApiEnabled(added.description, 'contribLabelFormatterWorkspaceTooltip') && formatter.formatting.workspaceTooltip) {
128
- formatter.formatting.workspaceTooltip = undefined;
129
- }
130
- this.formattersDisposables.set(formatter, labelService.registerFormatter(formatter));
131
- }
132
- }
133
- for (const removed of delta.removed) {
134
- for (const formatter of removed.value) {
135
- dispose(this.formattersDisposables.get(formatter));
136
- }
137
- }
138
- });
139
- }
140
- };
141
- ResourceLabelFormattersHandler = ( __decorate([
142
- ( __param(0, ILabelService))
143
- ], ResourceLabelFormattersHandler));
144
- ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(ResourceLabelFormattersHandler, 3 );
145
- const FORMATTER_CACHE_SIZE = 50;
146
- let LabelService = class LabelService extends Disposable {
147
- constructor(environmentService, contextService, pathService, remoteAgentService, storageService, lifecycleService) {
148
- super();
149
- this.environmentService = environmentService;
150
- this.contextService = contextService;
151
- this.pathService = pathService;
152
- this.remoteAgentService = remoteAgentService;
153
- this._onDidChangeFormatters = this._register(( new Emitter({ leakWarningThreshold: 400 })));
154
- this.onDidChangeFormatters = this._onDidChangeFormatters.event;
155
- this.os = OS;
156
- this.userHome = pathService.defaultUriScheme === Schemas.file ? this.pathService.userHome({ preferLocal: true }) : undefined;
157
- const memento = this.storedFormattersMemento = ( new Memento('cachedResourceLabelFormatters2', storageService));
158
- this.storedFormatters = memento.getMemento(0 , 1 );
159
- this.formatters = this.storedFormatters?.formatters?.slice() || [];
160
- this.resolveRemoteEnvironment();
161
- }
162
- async resolveRemoteEnvironment() {
163
- const env = await this.remoteAgentService.getEnvironment();
164
- this.os = env?.os ?? OS;
165
- this.userHome = await this.pathService.userHome();
166
- }
167
- findFormatting(resource) {
168
- let bestResult;
169
- for (const formatter of this.formatters) {
170
- if (formatter.scheme === resource.scheme) {
171
- if (!formatter.authority && (!bestResult || formatter.priority)) {
172
- bestResult = formatter;
173
- continue;
174
- }
175
- if (!formatter.authority) {
176
- continue;
177
- }
178
- if (match(formatter.authority.toLowerCase(), resource.authority.toLowerCase()) &&
179
- (!bestResult ||
180
- !bestResult.authority ||
181
- formatter.authority.length > bestResult.authority.length ||
182
- ((formatter.authority.length === bestResult.authority.length) && formatter.priority))) {
183
- bestResult = formatter;
184
- }
185
- }
186
- }
187
- return bestResult ? bestResult.formatting : undefined;
188
- }
189
- getUriLabel(resource, options = {}) {
190
- let formatting = this.findFormatting(resource);
191
- if (formatting && options.separator) {
192
- formatting = { ...formatting, separator: options.separator };
193
- }
194
- const label = this.doGetUriLabel(resource, formatting, options);
195
- if (!formatting && options.separator) {
196
- return label.replace(sepRegexp, options.separator);
197
- }
198
- return label;
199
- }
200
- doGetUriLabel(resource, formatting, options = {}) {
201
- if (!formatting) {
202
- return getPathLabel(resource, {
203
- os: this.os,
204
- tildify: this.userHome ? { userHome: this.userHome } : undefined,
205
- relative: options.relative ? {
206
- noPrefix: options.noPrefix,
207
- getWorkspace: () => this.contextService.getWorkspace(),
208
- getWorkspaceFolder: resource => this.contextService.getWorkspaceFolder(resource)
209
- } : undefined
210
- });
211
- }
212
- if (options.relative && this.contextService) {
213
- let folder = this.contextService.getWorkspaceFolder(resource);
214
- if (!folder) {
215
- const workspace = this.contextService.getWorkspace();
216
- const firstFolder = firstOrDefault(workspace.folders);
217
- if (firstFolder && resource.scheme !== firstFolder.uri.scheme && resource.path.startsWith(posix.sep)) {
218
- folder = this.contextService.getWorkspaceFolder(firstFolder.uri.with({ path: resource.path }));
219
- }
220
- }
221
- if (folder) {
222
- const folderLabel = this.formatUri(folder.uri, formatting, options.noPrefix);
223
- let relativeLabel = this.formatUri(resource, formatting, options.noPrefix);
224
- let overlap = 0;
225
- while (relativeLabel[overlap] && relativeLabel[overlap] === folderLabel[overlap]) {
226
- overlap++;
227
- }
228
- if (!relativeLabel[overlap] || relativeLabel[overlap] === formatting.separator) {
229
- relativeLabel = relativeLabel.substring(1 + overlap);
230
- }
231
- else if (overlap === folderLabel.length && folder.uri.path === posix.sep) {
232
- relativeLabel = relativeLabel.substring(overlap);
233
- }
234
- const hasMultipleRoots = this.contextService.getWorkspace().folders.length > 1;
235
- if (hasMultipleRoots && !options.noPrefix) {
236
- const rootName = folder?.name ?? basenameOrAuthority(folder.uri);
237
- relativeLabel = relativeLabel ? `${rootName} • ${relativeLabel}` : rootName;
238
- }
239
- return relativeLabel;
240
- }
241
- }
242
- return this.formatUri(resource, formatting, options.noPrefix);
243
- }
244
- getUriBasenameLabel(resource) {
245
- const formatting = this.findFormatting(resource);
246
- const label = this.doGetUriLabel(resource, formatting);
247
- let pathLib;
248
- if (formatting?.separator === win32.sep) {
249
- pathLib = win32;
250
- }
251
- else if (formatting?.separator === posix.sep) {
252
- pathLib = posix;
253
- }
254
- else {
255
- pathLib = ((this.os === 1) ) ? win32 : posix;
256
- }
257
- return pathLib.basename(label);
258
- }
259
- getWorkspaceLabel(workspace, options) {
260
- if (isWorkspace(workspace)) {
261
- const identifier = toWorkspaceIdentifier(workspace);
262
- if (isSingleFolderWorkspaceIdentifier(identifier) || isWorkspaceIdentifier(identifier)) {
263
- return this.getWorkspaceLabel(identifier, options);
264
- }
265
- return '';
266
- }
267
- if (URI.isUri(workspace)) {
268
- return this.doGetSingleFolderWorkspaceLabel(workspace, options);
269
- }
270
- if (isSingleFolderWorkspaceIdentifier(workspace)) {
271
- return this.doGetSingleFolderWorkspaceLabel(workspace.uri, options);
272
- }
273
- if (isWorkspaceIdentifier(workspace)) {
274
- return this.doGetWorkspaceLabel(workspace.configPath, options);
275
- }
276
- return '';
277
- }
278
- doGetWorkspaceLabel(workspaceUri, options) {
279
- if (isUntitledWorkspace(workspaceUri, this.environmentService)) {
280
- return ( localizeWithPath(
281
- 'vs/workbench/services/label/common/labelService',
282
- 'untitledWorkspace',
283
- "Untitled (Workspace)"
284
- ));
285
- }
286
- if (isTemporaryWorkspace(workspaceUri)) {
287
- return ( localizeWithPath(
288
- 'vs/workbench/services/label/common/labelService',
289
- 'temporaryWorkspace',
290
- "Workspace"
291
- ));
292
- }
293
- let filename = basename(workspaceUri);
294
- if (filename.endsWith(WORKSPACE_EXTENSION)) {
295
- filename = filename.substr(0, filename.length - WORKSPACE_EXTENSION.length - 1);
296
- }
297
- let label;
298
- switch (options?.verbose) {
299
- case 0 :
300
- label = filename;
301
- break;
302
- case 2 :
303
- label = ( localizeWithPath(
304
- 'vs/workbench/services/label/common/labelService',
305
- 'workspaceNameVerbose',
306
- "{0} (Workspace)",
307
- this.getUriLabel(joinPath(dirname(workspaceUri), filename))
308
- ));
309
- break;
310
- case 1 :
311
- default:
312
- label = ( localizeWithPath(
313
- 'vs/workbench/services/label/common/labelService',
314
- 'workspaceName',
315
- "{0} (Workspace)",
316
- filename
317
- ));
318
- break;
319
- }
320
- if (options?.verbose === 0 ) {
321
- return label;
322
- }
323
- return this.appendWorkspaceSuffix(label, workspaceUri);
324
- }
325
- doGetSingleFolderWorkspaceLabel(folderUri, options) {
326
- let label;
327
- switch (options?.verbose) {
328
- case 2 :
329
- label = this.getUriLabel(folderUri);
330
- break;
331
- case 0 :
332
- case 1 :
333
- default:
334
- label = basename(folderUri) || posix.sep;
335
- break;
336
- }
337
- if (options?.verbose === 0 ) {
338
- return label;
339
- }
340
- return this.appendWorkspaceSuffix(label, folderUri);
341
- }
342
- getSeparator(scheme, authority) {
343
- const formatter = this.findFormatting(( URI.from({ scheme, authority })));
344
- return formatter?.separator || posix.sep;
345
- }
346
- getHostLabel(scheme, authority) {
347
- const formatter = this.findFormatting(( URI.from({ scheme, authority })));
348
- return formatter?.workspaceSuffix || authority || '';
349
- }
350
- getHostTooltip(scheme, authority) {
351
- const formatter = this.findFormatting(( URI.from({ scheme, authority })));
352
- return formatter?.workspaceTooltip;
353
- }
354
- registerCachedFormatter(formatter) {
355
- const list = this.storedFormatters.formatters ??= [];
356
- let replace = list.findIndex(f => f.scheme === formatter.scheme && f.authority === formatter.authority);
357
- if (replace === -1 && list.length >= FORMATTER_CACHE_SIZE) {
358
- replace = FORMATTER_CACHE_SIZE - 1;
359
- }
360
- if (replace === -1) {
361
- list.unshift(formatter);
362
- }
363
- else {
364
- for (let i = replace; i > 0; i--) {
365
- list[i] = list[i - 1];
366
- }
367
- list[0] = formatter;
368
- }
369
- this.storedFormattersMemento.saveMemento();
370
- return this.registerFormatter(formatter);
371
- }
372
- registerFormatter(formatter) {
373
- this.formatters.push(formatter);
374
- this._onDidChangeFormatters.fire({ scheme: formatter.scheme });
375
- return {
376
- dispose: () => {
377
- this.formatters = this.formatters.filter(f => f !== formatter);
378
- this._onDidChangeFormatters.fire({ scheme: formatter.scheme });
379
- }
380
- };
381
- }
382
- formatUri(resource, formatting, forceNoTildify) {
383
- let label = formatting.label.replace(labelMatchingRegexp, (match, token, qsToken, qsValue) => {
384
- switch (token) {
385
- case 'scheme': return resource.scheme;
386
- case 'authority': return resource.authority;
387
- case 'authoritySuffix': {
388
- const i = resource.authority.indexOf('+');
389
- return i === -1 ? resource.authority : resource.authority.slice(i + 1);
390
- }
391
- case 'path':
392
- return formatting.stripPathStartingSeparator
393
- ? resource.path.slice(resource.path[0] === formatting.separator ? 1 : 0)
394
- : resource.path;
395
- default: {
396
- if (qsToken === 'query') {
397
- const { query } = resource;
398
- if (query && query[0] === '{' && query[query.length - 1] === '}') {
399
- try {
400
- return JSON.parse(query)[qsValue] || '';
401
- }
402
- catch { }
403
- }
404
- }
405
- return '';
406
- }
407
- }
408
- });
409
- if (formatting.normalizeDriveLetter && hasDriveLetterIgnorePlatform(label)) {
410
- label = label.charAt(1).toUpperCase() + label.substr(2);
411
- }
412
- if (formatting.tildify && !forceNoTildify) {
413
- if (this.userHome) {
414
- label = tildify(label, this.userHome.fsPath, this.os);
415
- }
416
- }
417
- if (formatting.authorityPrefix && resource.authority) {
418
- label = formatting.authorityPrefix + label;
419
- }
420
- return label.replace(sepRegexp, formatting.separator);
421
- }
422
- appendWorkspaceSuffix(label, uri) {
423
- const formatting = this.findFormatting(uri);
424
- const suffix = formatting && (typeof formatting.workspaceSuffix === 'string') ? formatting.workspaceSuffix : undefined;
425
- return suffix ? `${label} [${suffix}]` : label;
426
- }
427
- };
428
- LabelService = ( __decorate([
429
- ( __param(0, IWorkbenchEnvironmentService)),
430
- ( __param(1, IWorkspaceContextService)),
431
- ( __param(2, IPathService)),
432
- ( __param(3, IRemoteAgentService)),
433
- ( __param(4, IStorageService)),
434
- ( __param(5, ILifecycleService))
435
- ], LabelService));
436
-
437
- export { LabelService };
@@ -1,46 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
3
- import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
4
- import { OS } from 'vscode/vscode/vs/base/common/platform';
5
- import { Schemas } from 'vscode/vscode/vs/base/common/network';
6
- import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
7
- import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
8
- import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService';
9
-
10
- let TextResourcePropertiesService = class TextResourcePropertiesService {
11
- constructor(configurationService, remoteAgentService, environmentService, storageService) {
12
- this.configurationService = configurationService;
13
- this.environmentService = environmentService;
14
- this.storageService = storageService;
15
- this.remoteEnvironment = null;
16
- remoteAgentService.getEnvironment().then(remoteEnv => this.remoteEnvironment = remoteEnv);
17
- }
18
- getEOL(resource, language) {
19
- const eol = this.configurationService.getValue('files.eol', { overrideIdentifier: language, resource });
20
- if (eol && typeof eol === 'string' && eol !== 'auto') {
21
- return eol;
22
- }
23
- const os = this.getOS(resource);
24
- return os === 3 || os === 2 ? '\n' : '\r\n';
25
- }
26
- getOS(resource) {
27
- let os = OS;
28
- const remoteAuthority = this.environmentService.remoteAuthority;
29
- if (remoteAuthority) {
30
- if (resource && resource.scheme !== Schemas.file) {
31
- const osCacheKey = `resource.authority.os.${remoteAuthority}`;
32
- os = this.remoteEnvironment ? this.remoteEnvironment.os : this.storageService.getNumber(osCacheKey, 1 , OS);
33
- this.storageService.store(osCacheKey, os, 1 , 1 );
34
- }
35
- }
36
- return os;
37
- }
38
- };
39
- TextResourcePropertiesService = ( __decorate([
40
- ( __param(0, IConfigurationService)),
41
- ( __param(1, IRemoteAgentService)),
42
- ( __param(2, IWorkbenchEnvironmentService)),
43
- ( __param(3, IStorageService))
44
- ], TextResourcePropertiesService));
45
-
46
- export { TextResourcePropertiesService };