@codingame/monaco-vscode-base-service-override 37.6.1 → 38.0.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.
package/index.js CHANGED
@@ -17,13 +17,13 @@ import { ICanonicalUriService } from '@codingame/monaco-vscode-api/vscode/vs/pla
17
17
  import { IUserActivityService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userActivity/common/userActivityService.service';
18
18
  import { IDownloadService } from '@codingame/monaco-vscode-api/vscode/vs/platform/download/common/download.service';
19
19
  import { DownloadService } from './vscode/src/vs/platform/download/common/downloadService.js';
20
- import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service';
20
+ import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/platform/path/common/pathService.service';
21
21
  import { IWorkingCopyFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service';
22
22
  import { IRemoteAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
23
23
  import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
24
24
  import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
25
25
  import { guessLocalUserHome } from './vscode/src/vs/workbench/services/path/browser/pathService.js';
26
- import { AbstractPathService } from './vscode/src/vs/workbench/services/path/common/pathService.js';
26
+ import { AbstractPathService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService';
27
27
  import { UserActivityService } from './vscode/src/vs/workbench/services/userActivity/common/userActivityService.js';
28
28
  import { WorkingCopyFileService } from './vscode/src/vs/workbench/services/workingCopy/common/workingCopyFileService.js';
29
29
  import { ITrustedDomainService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/url/common/trustedDomainService.service';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-base-service-override",
3
- "version": "37.6.1",
3
+ "version": "38.0.0",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - base service-override",
6
6
  "keywords": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-api": "37.6.1"
18
+ "@codingame/monaco-vscode-api": "38.0.0"
19
19
  },
20
20
  "main": "index.js",
21
21
  "module": "index.js",
@@ -1,3 +1,3 @@
1
1
  import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
2
2
  import { IRequestContext, IRequestOptions } from "@codingame/monaco-vscode-api/vscode/vs/base/parts/request/common/request";
3
- export declare function request(options: IRequestOptions, token: CancellationToken, isOnline?: () => boolean): Promise<IRequestContext>;
3
+ export declare function request(options: IRequestOptions, token: CancellationToken, isOnline?: () => boolean, fetcher?: typeof fetch): Promise<IRequestContext>;
@@ -1,15 +1,27 @@
1
1
 
2
2
  import { bufferToStream, VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
3
3
  import { canceled } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
4
+ import { mark, clearMarks } from '@codingame/monaco-vscode-api/vscode/vs/base/common/performance';
5
+ import { StopWatch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stopwatch';
4
6
  import { OfflineError } from '@codingame/monaco-vscode-api/vscode/vs/base/parts/request/common/request';
5
7
 
6
- async function request(options, token, isOnline) {
8
+ async function request(options, token, isOnline, fetcher = fetch) {
7
9
  if (token.isCancellationRequested) {
8
10
  throw canceled();
9
11
  }
10
12
  const cancellation = ( new AbortController());
11
13
  const disposable = token.onCancellationRequested(() => cancellation.abort());
12
14
  const signal = options.timeout ? AbortSignal.any([cancellation.signal, AbortSignal.timeout(options.timeout)]) : cancellation.signal;
15
+ const watch = options.diagnosticId ? StopWatch.create(false) : undefined;
16
+ const marks = [];
17
+ let phase = "headers";
18
+ const trace = event => {
19
+ if (options.diagnosticId) {
20
+ const name = `code/request/${options.diagnosticId}/${event}`;
21
+ marks.push(name);
22
+ mark(name);
23
+ }
24
+ };
13
25
  try {
14
26
  const fetchInit = {
15
27
  method: options.type || "GET",
@@ -23,15 +35,32 @@ async function request(options, token, isOnline) {
23
35
  if (options.followRedirects === 0) {
24
36
  fetchInit.redirect = "manual";
25
37
  }
26
- const res = await fetch(options.url || "", fetchInit);
38
+ trace("start");
39
+ const res = await fetcher(options.url || "", fetchInit);
40
+ const responseHeadersMs = watch?.elapsed();
41
+ trace("headersReceived");
42
+ phase = "body";
43
+ const body = ( new Uint8Array(await res.arrayBuffer()));
44
+ const responseBodyMs = watch && responseHeadersMs !== undefined ? watch.elapsed() - responseHeadersMs : undefined;
45
+ trace("bodyReceived");
27
46
  return {
28
47
  res: {
29
48
  statusCode: res.status,
30
49
  headers: getResponseHeaders(res)
31
50
  },
32
- stream: bufferToStream(VSBuffer.wrap(( new Uint8Array(await res.arrayBuffer()))))
51
+ stream: bufferToStream(VSBuffer.wrap(body)),
52
+ ...(responseHeadersMs !== undefined && responseBodyMs !== undefined ? {
53
+ timings: {
54
+ responseHeadersMs,
55
+ responseBodyMs,
56
+ decodedBodyBytes: body.byteLength
57
+ }
58
+ } : {})
33
59
  };
34
60
  } catch (err) {
61
+ trace(
62
+ `${phase}/${token.isCancellationRequested || err?.name === "AbortError" ? "cancelled" : "failed"}`
63
+ );
35
64
  if (isOnline && !isOnline()) {
36
65
  throw ( new OfflineError());
37
66
  }
@@ -44,6 +73,9 @@ async function request(options, token, isOnline) {
44
73
  throw err;
45
74
  } finally {
46
75
  disposable.dispose();
76
+ for (const name of marks) {
77
+ clearMarks(name);
78
+ }
47
79
  }
48
80
  }
49
81
  function getRequestHeaders(options) {
@@ -9,10 +9,13 @@ class RequestChannelClient {
9
9
  this.onDidCompleteRequest = Event.None;
10
10
  }
11
11
  async request(options, token) {
12
- const [res, buffer] = await this.channel.call("request", [options], token);
12
+ const [res, buffer, timings] = await this.channel.call("request", [options], token);
13
13
  return {
14
14
  res,
15
- stream: bufferToStream(buffer)
15
+ stream: bufferToStream(buffer),
16
+ ...(timings ? {
17
+ timings
18
+ } : {})
16
19
  };
17
20
  }
18
21
  async resolveProxy(url) {
@@ -137,7 +137,7 @@ let JSONEditingService = class JSONEditingService {
137
137
  case JSONEditingErrorCode.ERROR_INVALID_FILE:
138
138
  {
139
139
  return localize(
140
- 21769,
140
+ 24344,
141
141
  "Unable to write into the file. Please open the file to correct errors/warnings in the file and try again."
142
142
  );
143
143
  }
@@ -180,15 +180,19 @@ class DecorationStyles {
180
180
  const iconClassName = rule.iconBadgeClassName;
181
181
  let tooltip = distinct(data.filter(d => !isFalsyOrWhitespace(d.tooltip)).map(d => d.tooltip)).join(" • ");
182
182
  const strikethrough = ( data.some(d => d.strikethrough));
183
+ const isTextBadge = !onlyChildren && !( data.some(decoration => ThemeIcon.isThemeIcon(decoration.letter))) && ( data.some(
184
+ decoration => typeof decoration.letter === "string" && decoration.letter.length > 0
185
+ ));
183
186
  if (onlyChildren) {
184
187
  badgeClassName = rule.bubbleBadgeClassName;
185
- tooltip = ( localize(21819, "Contains emphasized items"));
188
+ tooltip = ( localize(24394, "Contains emphasized items"));
186
189
  }
187
190
  return {
188
191
  labelClassName,
189
192
  badgeClassName,
190
193
  iconClassName,
191
194
  strikethrough,
195
+ isTextBadge,
192
196
  tooltip,
193
197
  dispose: () => {
194
198
  if (rule?.release()) {
@@ -6,14 +6,16 @@ import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs
6
6
  import { ResourceLabelFormatter, ResourceLabelFormatting, IFormatterChangeEvent, Verbosity, ResourceLabelTemplateFormatter } from "@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label";
7
7
  import { ILabelService } from "@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service";
8
8
  import { ILifecycleService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service";
9
- import { IPathService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service";
9
+ import { IPathService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService";
10
10
  import { IRemoteAgentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service";
11
11
  import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
12
+ import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
12
13
  export declare class LabelService extends Disposable implements ILabelService {
13
14
  private readonly environmentService;
14
15
  private readonly contextService;
15
16
  private readonly pathService;
16
17
  private readonly remoteAgentService;
18
+ private readonly uriIdentityService;
17
19
  readonly _serviceBrand: undefined;
18
20
  private formatters;
19
21
  private homeFormatters;
@@ -23,7 +25,7 @@ export declare class LabelService extends Disposable implements ILabelService {
23
25
  private readonly storedFormatters;
24
26
  private os;
25
27
  private userHome;
26
- constructor(environmentService: IWorkbenchEnvironmentService, contextService: IWorkspaceContextService, pathService: IPathService, remoteAgentService: IRemoteAgentService, storageService: IStorageService, lifecycleService: ILifecycleService);
28
+ constructor(environmentService: IWorkbenchEnvironmentService, contextService: IWorkspaceContextService, pathService: IPathService, remoteAgentService: IRemoteAgentService, storageService: IStorageService, lifecycleService: ILifecycleService, uriIdentityService: IUriIdentityService);
27
29
  private resolveRemoteEnvironment;
28
30
  getUriHome(resource: URI): URI | undefined;
29
31
  private findHomeFormatter;
@@ -10,7 +10,7 @@ import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/regist
10
10
  import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
11
11
  import { isWorkspace, toWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, isUntitledWorkspace, isTemporaryWorkspace, WORKSPACE_EXTENSION } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace';
12
12
  import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
13
- import { isEqualOrParent, relativePath, basenameOrAuthority, basename, joinPath, dirname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
13
+ import { basenameOrAuthority, basename, joinPath, dirname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
14
14
  import { getPathLabel, tildify } from '@codingame/monaco-vscode-api/vscode/vs/base/common/labels';
15
15
  import { Verbosity } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label';
16
16
  import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
@@ -19,7 +19,7 @@ import { match } from '@codingame/monaco-vscode-api/vscode/vs/base/common/glob';
19
19
  import { LifecyclePhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle';
20
20
  import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
21
21
  import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
22
- import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service';
22
+ import '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService';
23
23
  import { isProposedApiEnabled } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions';
24
24
  import { OS, OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
25
25
  import { IRemoteAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
@@ -27,12 +27,14 @@ import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/netw
27
27
  import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
28
28
  import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
29
29
  import { Memento } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/memento';
30
- import { escapeRegExpCharacters } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
30
+ import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
31
+ import { ResourceLabelTemplate } from './resourceLabelTemplate.js';
32
+ import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/platform/path/common/pathService.service';
31
33
 
32
34
  const resourceLabelFormattersExtPoint = ExtensionsRegistry.registerExtensionPoint({
33
35
  extensionPoint: "resourceLabelFormatters",
34
36
  jsonSchema: {
35
- description: ( localize(22134, "Contributes resource label formatting rules.")),
37
+ description: ( localize(24714, "Contributes resource label formatting rules.")),
36
38
  type: "array",
37
39
  items: {
38
40
  type: "object",
@@ -41,52 +43,52 @@ const resourceLabelFormattersExtPoint = ExtensionsRegistry.registerExtensionPoin
41
43
  scheme: {
42
44
  type: "string",
43
45
  description: ( localize(
44
- 22135,
46
+ 24715,
45
47
  "URI scheme on which to match the formatter on. For example \"file\". Simple glob patterns are supported."
46
48
  ))
47
49
  },
48
50
  authority: {
49
51
  type: "string",
50
52
  description: ( localize(
51
- 22136,
53
+ 24716,
52
54
  "URI authority on which to match the formatter on. Simple glob patterns are supported."
53
55
  ))
54
56
  },
55
57
  formatting: {
56
- description: ( localize(22137, "Rules for formatting uri resource labels.")),
58
+ description: ( localize(24717, "Rules for formatting uri resource labels.")),
57
59
  type: "object",
58
60
  properties: {
59
61
  label: {
60
62
  type: "string",
61
63
  description: ( localize(
62
- 22138,
64
+ 24718,
63
65
  "Label rules to display. For example: myLabel:/${path}. ${path}, ${scheme}, ${authority} and ${authoritySuffix} are supported as variables."
64
66
  ))
65
67
  },
66
68
  separator: {
67
69
  type: "string",
68
70
  description: ( localize(
69
- 22139,
71
+ 24719,
70
72
  "Separator to be used in the uri label display. '/' or '' as an example."
71
73
  ))
72
74
  },
73
75
  stripPathStartingSeparator: {
74
76
  type: "boolean",
75
77
  description: ( localize(
76
- 22140,
78
+ 24720,
77
79
  "Controls whether `${path}` substitutions should have starting separator characters stripped."
78
80
  ))
79
81
  },
80
82
  tildify: {
81
83
  type: "boolean",
82
84
  description: ( localize(
83
- 22141,
85
+ 24721,
84
86
  "Controls if the start of the uri label should be tildified when possible."
85
87
  ))
86
88
  },
87
89
  workspaceSuffix: {
88
90
  type: "string",
89
- description: ( localize(22142, "Suffix appended to the workspace label."))
91
+ description: ( localize(24722, "Suffix appended to the workspace label."))
90
92
  }
91
93
  }
92
94
  }
@@ -132,7 +134,6 @@ let ResourceLabelFormattersHandler = class ResourceLabelFormattersHandler {
132
134
  ResourceLabelFormattersHandler = ( __decorate([( __param(0, ILabelService))], ResourceLabelFormattersHandler));
133
135
  ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(ResourceLabelFormattersHandler, LifecyclePhase.Restored);
134
136
  const FORMATTER_CACHE_SIZE = 50;
135
- const homeTemplateParameterRegex = /^\$\{(?<name>[a-zA-Z_][\w]*)\}$/;
136
137
  function isTemplateFormatter(formatter) {
137
138
  return URI.isUri(formatter.home);
138
139
  }
@@ -143,13 +144,15 @@ let LabelService = class LabelService extends Disposable {
143
144
  pathService,
144
145
  remoteAgentService,
145
146
  storageService,
146
- lifecycleService
147
+ lifecycleService,
148
+ uriIdentityService
147
149
  ) {
148
150
  super();
149
151
  this.environmentService = environmentService;
150
152
  this.contextService = contextService;
151
153
  this.pathService = pathService;
152
154
  this.remoteAgentService = remoteAgentService;
155
+ this.uriIdentityService = uriIdentityService;
153
156
  this.homeFormatters = [];
154
157
  this._onDidChangeFormatters = this._register(( new Emitter({
155
158
  leakWarningThreshold: 400,
@@ -182,29 +185,23 @@ let LabelService = class LabelService extends Disposable {
182
185
  if (formatter.home.scheme !== resource.scheme || (formatter.home.authority && formatter.home.authority.toLowerCase() !== resource.authority.toLowerCase())) {
183
186
  continue;
184
187
  }
185
- const templateMatch = registration.templateMatcher.exec(resource.path);
188
+ const templateMatch = registration.template.match(resource, this.uriIdentityService.extUri);
186
189
  if (!templateMatch) {
187
190
  continue;
188
191
  }
189
- const parameters = ( new Map(Object.entries(templateMatch.groups ?? {})));
190
- const home = resource.with({
191
- path: templateMatch[0],
192
- query: null,
193
- fragment: null
194
- });
195
192
  const formatting = formatter.formatting({
196
193
  resource,
197
- home,
198
- parameters
194
+ home: templateMatch.home,
195
+ parameters: templateMatch.parameters
199
196
  });
200
197
  if (!formatting) {
201
198
  continue;
202
199
  }
203
200
  const result = {
204
- home,
201
+ home: templateMatch.home,
205
202
  formatting,
206
203
  literalLabel: true,
207
- homeLength: home.path.length,
204
+ homeLength: templateMatch.home.path.length,
208
205
  authorityLength: formatter.home.authority.length
209
206
  };
210
207
  if (!bestResult || result.homeLength > bestResult.homeLength || (result.homeLength === bestResult.homeLength && result.authorityLength > bestResult.authorityLength) || (result.homeLength === bestResult.homeLength && result.authorityLength === bestResult.authorityLength && !bestResultIsTemplate)) {
@@ -219,7 +216,7 @@ let LabelService = class LabelService extends Disposable {
219
216
  for (const formatter of this.formatters) {
220
217
  if (!formatter.home || formatter.scheme !== resource.scheme || (formatter.authority && !match(formatter.authority, resource.authority, {
221
218
  ignoreCase: true
222
- })) || !isEqualOrParent(resource, resource.with({
219
+ })) || !this.uriIdentityService.extUri.isEqualOrParent(resource, resource.with({
223
220
  path: formatter.home
224
221
  }))) {
225
222
  continue;
@@ -266,7 +263,10 @@ let LabelService = class LabelService extends Disposable {
266
263
  const homeFormatter = options.noPrefix ? undefined : this.findHomeFormatter(resource);
267
264
  if (homeFormatter) {
268
265
  const separator = options.separator ?? homeFormatter.formatting.separator;
269
- const path = relativePath(homeFormatter.home, resource);
266
+ const homeWithResourceCasing = homeFormatter.home.with({
267
+ path: resource.path.slice(0, homeFormatter.home.path.length)
268
+ });
269
+ const path = this.uriIdentityService.extUri.relativePath(homeWithResourceCasing, resource);
270
270
  const label = homeFormatter.literalLabel ? homeFormatter.formatting.label : this.formatUri(homeFormatter.home, homeFormatter.formatting);
271
271
  return path ? `${label}${separator}${this.adjustPathSeparators(path, separator)}` : label;
272
272
  }
@@ -367,10 +367,10 @@ let LabelService = class LabelService extends Disposable {
367
367
  }
368
368
  doGetWorkspaceLabel(workspaceUri, options) {
369
369
  if (isUntitledWorkspace(workspaceUri, this.environmentService)) {
370
- return localize(22143, "Untitled (Workspace)");
370
+ return localize(24723, "Untitled (Workspace)");
371
371
  }
372
372
  if (isTemporaryWorkspace(workspaceUri)) {
373
- return localize(22144, "Workspace");
373
+ return localize(24724, "Workspace");
374
374
  }
375
375
  let filename = basename(workspaceUri);
376
376
  if (filename.endsWith(WORKSPACE_EXTENSION)) {
@@ -383,14 +383,14 @@ let LabelService = class LabelService extends Disposable {
383
383
  break;
384
384
  case Verbosity.LONG:
385
385
  label = ( localize(
386
- 22145,
386
+ 24725,
387
387
  "{0} (Workspace)",
388
388
  this.getUriLabel(joinPath(dirname(workspaceUri), filename))
389
389
  ));
390
390
  break;
391
391
  case Verbosity.MEDIUM:
392
392
  default:
393
- label = ( localize(22146, "{0} (Workspace)", filename));
393
+ label = ( localize(24726, "{0} (Workspace)", filename));
394
394
  break;
395
395
  }
396
396
  if (options?.verbose === Verbosity.SHORT) {
@@ -484,32 +484,9 @@ let LabelService = class LabelService extends Disposable {
484
484
  };
485
485
  }
486
486
  createTemplateFormatterRegistration(formatter) {
487
- const {
488
- home
489
- } = formatter;
490
- const homePath = home.path.length > 1 ? home.path.replace(/\/+$/, "") : home.path;
491
- const parameterNames = ( new Set());
492
- const matcherPattern = homePath.split("/").map(segment => {
493
- const parameterMatch = homeTemplateParameterRegex.exec(segment);
494
- if (parameterMatch?.groups?.name) {
495
- const parameterName = parameterMatch.groups.name;
496
- if (( parameterNames.has(parameterName))) {
497
- throw ( new Error(`Duplicate resource label home template parameter: ${parameterName}`));
498
- }
499
- parameterNames.add(parameterName);
500
- return `(?<${parameterName}>(?!\\.{1,2}(?:/|$))[^/]+)`;
501
- }
502
- if (segment.includes("${")) {
503
- throw ( new Error(
504
- `Resource label home template parameters must occupy an entire path segment: ${segment}`
505
- ));
506
- }
507
- return escapeRegExpCharacters(segment);
508
- }).join("/");
509
- const isRootHome = homePath === "" || homePath === "/";
510
487
  return {
511
488
  formatter,
512
- templateMatcher: ( new RegExp(`^${matcherPattern}${isRootHome ? "" : "(?=/|$)"}`))
489
+ template: ( new ResourceLabelTemplate(formatter.home))
513
490
  };
514
491
  }
515
492
  formatUri(resource, formatting, forceNoTildify) {
@@ -581,6 +558,6 @@ let LabelService = class LabelService extends Disposable {
581
558
  return suffix ? `${label} [${suffix}]` : label;
582
559
  }
583
560
  };
584
- LabelService = ( __decorate([( __param(0, IWorkbenchEnvironmentService)), ( __param(1, IWorkspaceContextService)), ( __param(2, IPathService)), ( __param(3, IRemoteAgentService)), ( __param(4, IStorageService)), ( __param(5, ILifecycleService))], LabelService));
561
+ LabelService = ( __decorate([( __param(0, IWorkbenchEnvironmentService)), ( __param(1, IWorkspaceContextService)), ( __param(2, IPathService)), ( __param(3, IRemoteAgentService)), ( __param(4, IStorageService)), ( __param(5, ILifecycleService)), ( __param(6, IUriIdentityService))], LabelService));
585
562
 
586
563
  export { LabelService };
@@ -0,0 +1,13 @@
1
+ import { IExtUri } from "@codingame/monaco-vscode-api/vscode/vs/base/common/resources";
2
+ import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
3
+ export interface IResourceLabelTemplateMatch {
4
+ readonly home: URI;
5
+ readonly parameters: ReadonlyMap<string, string>;
6
+ }
7
+ export declare class ResourceLabelTemplate {
8
+ private readonly home;
9
+ private readonly segments;
10
+ private readonly isRoot;
11
+ constructor(home: URI);
12
+ match(resource: URI, extUri: IExtUri): IResourceLabelTemplateMatch | undefined;
13
+ }
@@ -0,0 +1,89 @@
1
+
2
+ import { isEqualAuthority } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
3
+
4
+ const templateParameterRegex = /^\$\{(?<name>[a-zA-Z_][\w]*)\}$/;
5
+ class ResourceLabelTemplate {
6
+ constructor(home) {
7
+ this.home = home;
8
+ const homePath = home.path.length > 1 ? home.path.replace(/\/+$/, "") : home.path;
9
+ this.isRoot = homePath === "" || homePath === "/";
10
+ const parameterNames = ( new Set());
11
+ this.segments = this.isRoot ? [] : homePath.split("/").map(segment => {
12
+ const parameterMatch = templateParameterRegex.exec(segment);
13
+ if (parameterMatch?.groups?.name) {
14
+ const parameter = parameterMatch.groups.name;
15
+ if (( parameterNames.has(parameter))) {
16
+ throw ( new Error(`Duplicate resource label home template parameter: ${parameter}`));
17
+ }
18
+ parameterNames.add(parameter);
19
+ return {
20
+ kind: "parameter",
21
+ value: parameter
22
+ };
23
+ }
24
+ if (segment.includes("${")) {
25
+ throw ( new Error(
26
+ `Resource label home template parameters must occupy an entire path segment: ${segment}`
27
+ ));
28
+ }
29
+ return {
30
+ kind: "literal",
31
+ value: segment
32
+ };
33
+ });
34
+ }
35
+ match(resource, extUri) {
36
+ if (this.home.scheme !== resource.scheme || (this.home.authority && !isEqualAuthority(this.home.authority, resource.authority))) {
37
+ return undefined;
38
+ }
39
+ if (this.isRoot) {
40
+ return {
41
+ home: resource.with({
42
+ path: this.home.path,
43
+ query: null,
44
+ fragment: null
45
+ }),
46
+ parameters: ( new Map())
47
+ };
48
+ }
49
+ const resourceSegments = resource.path.split("/");
50
+ if (resourceSegments.length < this.segments.length) {
51
+ return undefined;
52
+ }
53
+ const parameters = ( new Map());
54
+ for (let index = 0; index < this.segments.length; index++) {
55
+ const templateSegment = this.segments[index];
56
+ const resourceSegment = resourceSegments[index];
57
+ if (templateSegment.kind === "parameter") {
58
+ if (resourceSegment === "." || resourceSegment === "..") {
59
+ return undefined;
60
+ }
61
+ parameters.set(templateSegment.value, resourceSegment);
62
+ continue;
63
+ }
64
+ const resourceSegmentUri = resource.with({
65
+ path: `/${resourceSegment}`,
66
+ query: null,
67
+ fragment: null
68
+ });
69
+ const templateSegmentUri = resource.with({
70
+ path: `/${templateSegment.value}`,
71
+ query: null,
72
+ fragment: null
73
+ });
74
+ if (!extUri.isEqual(resourceSegmentUri, templateSegmentUri)) {
75
+ return undefined;
76
+ }
77
+ }
78
+ return {
79
+ home: resource.with({
80
+ path: resourceSegments.slice(0, this.segments.length).join("/"),
81
+ query: null,
82
+ fragment: null
83
+ }),
84
+ parameters
85
+ };
86
+ }
87
+ }
88
+
89
+ export { ResourceLabelTemplate };
@@ -1,5 +1,5 @@
1
1
  import { IRemoteAgentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service";
2
- import { AbstractPathService } from "../common/pathService.js";
2
+ import { AbstractPathService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService";
3
3
  import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
4
4
  import { IWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service";
5
5
  import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
@@ -1,7 +1,7 @@
1
1
 
2
2
  import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
3
3
  import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
4
- import { AbstractPathService } from '../common/pathService.js';
4
+ import { AbstractPathService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService';
5
5
  import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
6
6
  import { dirname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
7
7
 
@@ -15,7 +15,7 @@ import { mainWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/
15
15
  let BrowserRequestService = class BrowserRequestService extends AbstractRequestService {
16
16
  constructor(remoteAgentService, configurationService, loggerService) {
17
17
  const logger = loggerService.createLogger(`network`, {
18
- name: ( localize(22278, "Network")),
18
+ name: ( localize(24874, "Network")),
19
19
  group: windowLogGroup
20
20
  });
21
21
  const logService = ( new LogService(logger));
@@ -9,6 +9,7 @@ import { Disposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs
9
9
  import { LinkedList } from '@codingame/monaco-vscode-api/vscode/vs/base/common/linkedList';
10
10
  import { isCancellationError, CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
11
11
  import { NotificationPriority } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification';
12
+ import { NotificationTelemetryId } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notificationTelemetry';
12
13
  import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
13
14
 
14
15
  let StoredFileWorkingCopySaveParticipant = class StoredFileWorkingCopySaveParticipant extends Disposable {
@@ -29,13 +30,14 @@ let StoredFileWorkingCopySaveParticipant = class StoredFileWorkingCopySavePartic
29
30
  const cts = ( new CancellationTokenSource(token));
30
31
  workingCopy.model?.pushStackElement();
31
32
  progress.report({
32
- message: ( localize(22681, "Running Code Actions and Formatters..."))
33
+ message: ( localize(25277, "Running Code Actions and Formatters..."))
33
34
  });
34
35
  let bubbleCancel = false;
35
36
  await this.progressService.withProgress({
37
+ telemetry: NotificationTelemetryId.WorkingCopySaveParticipants,
36
38
  priority: NotificationPriority.URGENT,
37
39
  location: ProgressLocation.Notification,
38
- cancellable: ( localize(22682, "Skip")),
40
+ cancellable: ( localize(25278, "Skip")),
39
41
  delay: workingCopy.isDirty() ? 5000 : 3000
40
42
  }, async progress => {
41
43
  const participants = Array.from(this.saveParticipants).sort((a, b) => {
@@ -1,32 +0,0 @@
1
- import { IPath } from "@codingame/monaco-vscode-api/vscode/vs/base/common/path";
2
- import { OperatingSystem } from "@codingame/monaco-vscode-api/vscode/vs/base/common/platform";
3
- import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
4
- import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
5
- import { IWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service";
6
- import { IRemoteAgentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service";
7
- import { IPathService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service";
8
- export declare abstract class AbstractPathService implements IPathService {
9
- private localUserHome;
10
- private readonly remoteAgentService;
11
- private readonly environmentService;
12
- private contextService;
13
- readonly _serviceBrand: undefined;
14
- private resolveOS;
15
- private resolveUserHome;
16
- private maybeUnresolvedUserHome;
17
- constructor(localUserHome: URI, remoteAgentService: IRemoteAgentService, environmentService: IWorkbenchEnvironmentService, contextService: IWorkspaceContextService);
18
- hasValidBasename(resource: URI, basename?: string): Promise<boolean>;
19
- hasValidBasename(resource: URI, os: OperatingSystem, basename?: string): boolean;
20
- private doHasValidBasename;
21
- get defaultUriScheme(): string;
22
- static findDefaultUriScheme(environmentService: IWorkbenchEnvironmentService, contextService: IWorkspaceContextService): string;
23
- userHome(options?: {
24
- preferLocal: boolean;
25
- }): Promise<URI>;
26
- userHome(options: {
27
- preferLocal: true;
28
- }): URI;
29
- get resolvedUserHome(): URI | undefined;
30
- get path(): Promise<IPath>;
31
- fileURI(_path: string): Promise<URI>;
32
- }
@@ -1,102 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { isValidBasename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/extpath';
4
- import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
5
- import { win32, posix } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
6
- import { OS, OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
7
- import { basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
8
- import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
9
- import { getVirtualWorkspaceScheme } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/virtualWorkspace';
10
- import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
11
- import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
12
- import { IRemoteAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
13
-
14
- var AbstractPathService_1;
15
- let AbstractPathService = AbstractPathService_1 = class AbstractPathService {
16
- constructor(localUserHome, remoteAgentService, environmentService, contextService) {
17
- this.localUserHome = localUserHome;
18
- this.remoteAgentService = remoteAgentService;
19
- this.environmentService = environmentService;
20
- this.contextService = contextService;
21
- this.resolveOS = (async () => {
22
- const env = await this.remoteAgentService.getEnvironment();
23
- return env?.os || OS;
24
- })();
25
- this.resolveUserHome = (async () => {
26
- const env = await this.remoteAgentService.getEnvironment();
27
- const userHome = this.maybeUnresolvedUserHome = env?.userHome ?? localUserHome;
28
- return userHome;
29
- })();
30
- }
31
- hasValidBasename(resource, arg2, basename) {
32
- if (typeof arg2 === "string" || typeof arg2 === "undefined") {
33
- return this.resolveOS.then(os => this.doHasValidBasename(resource, os, arg2));
34
- }
35
- return this.doHasValidBasename(resource, arg2, basename);
36
- }
37
- doHasValidBasename(resource, os, name) {
38
- if (resource.scheme === Schemas.file || resource.scheme === Schemas.vscodeRemote) {
39
- return isValidBasename(name ?? basename(resource), os === OperatingSystem.Windows);
40
- }
41
- return true;
42
- }
43
- get defaultUriScheme() {
44
- return AbstractPathService_1.findDefaultUriScheme(this.environmentService, this.contextService);
45
- }
46
- static findDefaultUriScheme(environmentService, contextService) {
47
- if (environmentService.remoteAuthority) {
48
- return Schemas.vscodeRemote;
49
- }
50
- const virtualWorkspace = getVirtualWorkspaceScheme(contextService.getWorkspace());
51
- if (virtualWorkspace) {
52
- return virtualWorkspace;
53
- }
54
- const firstFolder = contextService.getWorkspace().folders[0];
55
- if (firstFolder) {
56
- return firstFolder.uri.scheme;
57
- }
58
- const configuration = contextService.getWorkspace().configuration;
59
- if (configuration) {
60
- return configuration.scheme;
61
- }
62
- return Schemas.file;
63
- }
64
- userHome(options) {
65
- return options?.preferLocal ? this.localUserHome : this.resolveUserHome;
66
- }
67
- get resolvedUserHome() {
68
- return this.maybeUnresolvedUserHome;
69
- }
70
- get path() {
71
- return this.resolveOS.then(os => {
72
- return os === OperatingSystem.Windows ? win32 : posix;
73
- });
74
- }
75
- async fileURI(_path) {
76
- let authority = "";
77
- const os = await this.resolveOS;
78
- if (os === OperatingSystem.Windows) {
79
- _path = _path.replace(/\\/g, "/");
80
- }
81
- if (_path[0] === "/" && _path[1] === "/") {
82
- const idx = _path.indexOf("/", 2);
83
- if (idx === -1) {
84
- authority = _path.substring(2);
85
- _path = "/";
86
- } else {
87
- authority = _path.substring(2, idx);
88
- _path = _path.substring(idx) || "/";
89
- }
90
- }
91
- return ( URI.from({
92
- scheme: Schemas.file,
93
- authority,
94
- path: _path,
95
- query: "",
96
- fragment: ""
97
- }));
98
- }
99
- };
100
- AbstractPathService = AbstractPathService_1 = ( __decorate([( __param(1, IRemoteAgentService)), ( __param(2, IWorkbenchEnvironmentService)), ( __param(3, IWorkspaceContextService))], AbstractPathService));
101
-
102
- export { AbstractPathService };