@codingame/monaco-vscode-explorer-service-override 11.1.2 → 12.0.1

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.d.ts CHANGED
@@ -1 +1,3 @@
1
- export { default } from 'vscode/service-override/explorer';
1
+ import type { IEditorOverrideServices } from "vscode/vscode/vs/editor/standalone/browser/standaloneServices";
2
+ declare function getServiceOverride(): IEditorOverrideServices;
3
+ export default getServiceOverride;
package/index.js CHANGED
@@ -1 +1,15 @@
1
- export { default } from './explorer.js';
1
+
2
+ import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
3
+ import { ExplorerService } from './vscode/src/vs/workbench/contrib/files/browser/explorerService.js';
4
+ import { IExplorerService } from 'vscode/vscode/vs/workbench/contrib/files/browser/files.service';
5
+ import '@codingame/monaco-vscode-5945a5e2-a66c-5a82-bd2c-1965724b29eb-common/vscode/vs/workbench/contrib/files/browser/fileCommands';
6
+ import '@codingame/monaco-vscode-5945a5e2-a66c-5a82-bd2c-1965724b29eb-common/vscode/vs/workbench/contrib/files/browser/fileActions.contribution';
7
+ import './vscode/src/vs/workbench/contrib/files/browser/files.contribution._explorer.js';
8
+
9
+ function getServiceOverride() {
10
+ return {
11
+ [IExplorerService.toString()]: new SyncDescriptor(ExplorerService, [], true)
12
+ };
13
+ }
14
+
15
+ export { getServiceOverride as default };
package/package.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-explorer-service-override",
3
- "version": "11.1.2",
3
+ "version": "12.0.1",
4
+ "private": false,
5
+ "description": "VSCode public API plugged on the monaco editor - explorer service-override",
4
6
  "keywords": [],
5
7
  "author": {
6
8
  "name": "CodinGame",
@@ -12,8 +14,18 @@
12
14
  "url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
13
15
  },
14
16
  "type": "module",
15
- "private": false,
16
- "description": "VSCode public API plugged on the monaco editor - explorer service-override",
17
+ "dependencies": {
18
+ "@codingame/monaco-vscode-15626ec7-b165-51e1-8caf-7bcc2ae9b95a-common": "12.0.1",
19
+ "@codingame/monaco-vscode-5945a5e2-a66c-5a82-bd2c-1965724b29eb-common": "12.0.1",
20
+ "@codingame/monaco-vscode-a4683c2b-a0d2-5112-96ba-eedc605346d2-common": "12.0.1",
21
+ "@codingame/monaco-vscode-b1e8558d-1726-5299-bc75-e43ee6d1a124-common": "12.0.1",
22
+ "@codingame/monaco-vscode-b71b5434-ce96-5581-8993-e8da380bd63f-common": "12.0.1",
23
+ "@codingame/monaco-vscode-cc9ccbec-e2a1-599d-84ae-46f5efc666e3-common": "12.0.1",
24
+ "@codingame/monaco-vscode-d481a59e-259c-524e-bee1-76483d75d3a1-common": "12.0.1",
25
+ "vscode": "npm:@codingame/monaco-vscode-api@12.0.1"
26
+ },
27
+ "peerDependencies": {},
28
+ "peerDependenciesMeta": {},
17
29
  "main": "index.js",
18
30
  "module": "index.js",
19
31
  "types": "index.d.ts",
@@ -22,10 +34,12 @@
22
34
  "default": "./index.js"
23
35
  },
24
36
  "./vscode/*": {
25
- "default": "./vscode/src/*.js"
37
+ "default": "./vscode/src/*.js",
38
+ "types": "./vscode/src/*.d.ts"
39
+ },
40
+ "./*": {
41
+ "default": "./*.js",
42
+ "types": "./*.d.ts"
26
43
  }
27
- },
28
- "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@11.1.2"
30
44
  }
31
45
  }
@@ -0,0 +1,72 @@
1
+ import { IWorkspaceContextService } from "vscode/vscode/vs/platform/workspace/common/workspace.service";
2
+ import { ISortOrderConfiguration } from "@codingame/monaco-vscode-cc9ccbec-e2a1-599d-84ae-46f5efc666e3-common/vscode/vs/workbench/contrib/files/common/files";
3
+ import { ExplorerItem } from "@codingame/monaco-vscode-a4683c2b-a0d2-5112-96ba-eedc605346d2-common/vscode/vs/workbench/contrib/files/common/explorerModel";
4
+ import { URI } from "vscode/vscode/vs/base/common/uri";
5
+ import { IFileService } from "vscode/vscode/vs/platform/files/common/files.service";
6
+ import { IConfigurationService } from "vscode/vscode/vs/platform/configuration/common/configuration.service";
7
+ import { IClipboardService } from "vscode/vscode/vs/platform/clipboard/common/clipboardService.service";
8
+ import { IEditorService } from "vscode/vscode/vs/workbench/services/editor/common/editorService.service";
9
+ import { IEditableData } from "vscode/vscode/vs/workbench/common/views";
10
+ import { IUriIdentityService } from "vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
11
+ import { IBulkEditService, ResourceFileEdit } from "vscode/vscode/vs/editor/browser/services/bulkEditService";
12
+ import { UndoRedoSource } from "vscode/vscode/vs/platform/undoRedo/common/undoRedo";
13
+ import { IExplorerView } from "@codingame/monaco-vscode-5945a5e2-a66c-5a82-bd2c-1965724b29eb-common/vscode/vs/workbench/contrib/files/browser/files";
14
+ import { IExplorerService } from "vscode/vscode/vs/workbench/contrib/files/browser/files.service";
15
+ import { ProgressLocation } from "vscode/vscode/vs/platform/progress/common/progress";
16
+ import { IProgressService } from "vscode/vscode/vs/platform/progress/common/progress.service";
17
+ import { IHostService } from "vscode/vscode/vs/workbench/services/host/browser/host.service";
18
+ import { IFilesConfigurationService } from "vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service";
19
+ import { ITelemetryService } from "vscode/vscode/vs/platform/telemetry/common/telemetry.service";
20
+ export declare const UNDO_REDO_SOURCE: UndoRedoSource;
21
+ export declare class ExplorerService implements IExplorerService {
22
+ private fileService;
23
+ private configurationService;
24
+ private contextService;
25
+ private clipboardService;
26
+ private editorService;
27
+ private readonly uriIdentityService;
28
+ private readonly bulkEditService;
29
+ private readonly progressService;
30
+ private readonly filesConfigurationService;
31
+ private readonly telemetryService;
32
+ readonly _serviceBrand: undefined;
33
+ private static readonly EXPLORER_FILE_CHANGES_REACT_DELAY;
34
+ private readonly disposables;
35
+ private editable;
36
+ private config;
37
+ private cutItems;
38
+ private view;
39
+ private model;
40
+ private onFileChangesScheduler;
41
+ private fileChangeEvents;
42
+ private revealExcludeMatcher;
43
+ constructor(fileService: IFileService, configurationService: IConfigurationService, contextService: IWorkspaceContextService, clipboardService: IClipboardService, editorService: IEditorService, uriIdentityService: IUriIdentityService, bulkEditService: IBulkEditService, progressService: IProgressService, hostService: IHostService, filesConfigurationService: IFilesConfigurationService, telemetryService: ITelemetryService);
44
+ get roots(): ExplorerItem[];
45
+ get sortOrderConfiguration(): ISortOrderConfiguration;
46
+ registerView(contextProvider: IExplorerView): void;
47
+ getContext(respectMultiSelection: boolean, ignoreNestedChildren?: boolean): ExplorerItem[];
48
+ applyBulkEdit(edit: ResourceFileEdit[], options: {
49
+ undoLabel: string;
50
+ progressLabel: string;
51
+ confirmBeforeUndo?: boolean;
52
+ progressLocation?: ProgressLocation.Explorer | ProgressLocation.Window;
53
+ }): Promise<void>;
54
+ hasViewFocus(): boolean;
55
+ findClosest(resource: URI): ExplorerItem | null;
56
+ findClosestRoot(resource: URI): ExplorerItem | null;
57
+ setEditable(stat: ExplorerItem, data: IEditableData | null): Promise<void>;
58
+ setToCopy(items: ExplorerItem[], cut: boolean): Promise<void>;
59
+ isCut(item: ExplorerItem): boolean;
60
+ getEditable(): {
61
+ stat: ExplorerItem;
62
+ data: IEditableData;
63
+ } | undefined;
64
+ getEditableData(stat: ExplorerItem): IEditableData | undefined;
65
+ isEditable(stat: ExplorerItem | undefined): boolean;
66
+ select(resource: URI, reveal?: boolean | string): Promise<void>;
67
+ refresh(reveal?: boolean): Promise<void>;
68
+ private onDidRunOperation;
69
+ private shouldAutoRevealItem;
70
+ private onConfigurationUpdated;
71
+ dispose(): void;
72
+ }
@@ -1,8 +1,11 @@
1
- import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
1
+
2
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
2
3
  import { Event } from 'vscode/vscode/vs/base/common/event';
3
4
  import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
4
5
  import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
5
- import { ExplorerModel, ExplorerItem } from 'vscode/vscode/vs/workbench/contrib/files/common/explorerModel';
6
+ import { SortOrder, LexicographicOptions } from '@codingame/monaco-vscode-cc9ccbec-e2a1-599d-84ae-46f5efc666e3-common/vscode/vs/workbench/contrib/files/common/files';
7
+ import { ExplorerModel, ExplorerItem } from '@codingame/monaco-vscode-a4683c2b-a0d2-5112-96ba-eedc605346d2-common/vscode/vs/workbench/contrib/files/common/explorerModel';
8
+ import { FileChangeType, FileOperation } from 'vscode/vscode/vs/platform/files/common/files';
6
9
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
7
10
  import { dirname, basename } from 'vscode/vscode/vs/base/common/resources';
8
11
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
@@ -11,11 +14,12 @@ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/commo
11
14
  import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
12
15
  import { IBulkEditService } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
13
16
  import { UndoRedoSource } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo';
17
+ import { ProgressLocation } from 'vscode/vscode/vs/platform/progress/common/progress';
14
18
  import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/progress.service';
15
19
  import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
16
20
  import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
17
21
  import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
18
- import { ResourceGlobMatcher } from 'vscode/vscode/vs/workbench/common/resources';
22
+ import { ResourceGlobMatcher } from '@codingame/monaco-vscode-a4683c2b-a0d2-5112-96ba-eedc605346d2-common/vscode/vs/workbench/common/resources';
19
23
  import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service';
20
24
  import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
21
25
 
@@ -50,9 +54,9 @@ let ExplorerService = class ExplorerService {
50
54
  this.onFileChangesScheduler = ( new RunOnceScheduler(async () => {
51
55
  const events = this.fileChangeEvents;
52
56
  this.fileChangeEvents = [];
53
- const types = [2 ];
54
- if (this.config.sortOrder === "modified" ) {
55
- types.push(0 );
57
+ const types = [FileChangeType.DELETED];
58
+ if (this.config.sortOrder === SortOrder.Modified) {
59
+ types.push(FileChangeType.UPDATED);
56
60
  }
57
61
  let shouldRefresh = false;
58
62
  this.roots.forEach(r => {
@@ -149,9 +153,9 @@ let ExplorerService = class ExplorerService {
149
153
  }
150
154
  async applyBulkEdit(edit, options) {
151
155
  const cancellationTokenSource = ( new CancellationTokenSource());
152
- const location = options.progressLocation ?? 10 ;
156
+ const location = options.progressLocation ?? ProgressLocation.Window;
153
157
  let progressOptions;
154
- if (location === 10 ) {
158
+ if (location === ProgressLocation.Window) {
155
159
  progressOptions = {
156
160
  location: location,
157
161
  title: options.progressLabel,
@@ -176,7 +180,7 @@ let ExplorerService = class ExplorerService {
176
180
  confirmBeforeUndo: options.confirmBeforeUndo
177
181
  });
178
182
  }, () => cancellationTokenSource.cancel());
179
- await this.progressService.withProgress({ location: 1 , delay: 500 }, () => promise);
183
+ await this.progressService.withProgress({ location: ProgressLocation.Explorer, delay: 500 }, () => promise);
180
184
  cancellationTokenSource.dispose();
181
185
  }
182
186
  hasViewFocus() {
@@ -256,7 +260,7 @@ let ExplorerService = class ExplorerService {
256
260
  await this.view.selectResource(fileStat.resource, reveal);
257
261
  return Promise.resolve(undefined);
258
262
  }
259
- const options = { resolveTo: [resource], resolveMetadata: this.config.sortOrder === "modified" };
263
+ const options = { resolveTo: [resource], resolveMetadata: this.config.sortOrder === SortOrder.Modified };
260
264
  const root = this.findClosestRoot(resource);
261
265
  if (!root) {
262
266
  return undefined;
@@ -278,6 +282,9 @@ let ExplorerService = class ExplorerService {
278
282
  }
279
283
  }
280
284
  async refresh(reveal = true) {
285
+ if (this.view?.hasPhantomElements()) {
286
+ return;
287
+ }
281
288
  this.model.roots.forEach(r => r.forgetChildren());
282
289
  if (this.view) {
283
290
  await this.view.refresh(true);
@@ -290,7 +297,7 @@ let ExplorerService = class ExplorerService {
290
297
  }
291
298
  async onDidRunOperation(e) {
292
299
  const shouldDeepRefresh = this.config.fileNesting.enabled;
293
- if (e.isOperation(0 ) || e.isOperation(3 )) {
300
+ if (e.isOperation(FileOperation.CREATE) || e.isOperation(FileOperation.COPY)) {
294
301
  const addedElement = e.target;
295
302
  const parentResource = dirname(addedElement.resource);
296
303
  const parents = this.model.findAll(parentResource);
@@ -311,7 +318,7 @@ let ExplorerService = class ExplorerService {
311
318
  })));
312
319
  }
313
320
  }
314
- else if (e.isOperation(2 )) {
321
+ else if (e.isOperation(FileOperation.MOVE)) {
315
322
  const oldResource = e.resource;
316
323
  const newElement = e.target;
317
324
  const oldParentResource = dirname(oldResource);
@@ -340,7 +347,7 @@ let ExplorerService = class ExplorerService {
340
347
  }
341
348
  }
342
349
  }
343
- else if (e.isOperation(1 )) {
350
+ else if (e.isOperation(FileOperation.DELETE)) {
344
351
  const modelElements = this.model.findAll(e.resource);
345
352
  await Promise.all(( modelElements.map(async (modelElement) => {
346
353
  if (modelElement.parent) {
@@ -389,11 +396,11 @@ let ExplorerService = class ExplorerService {
389
396
  shouldRefresh = true;
390
397
  }
391
398
  const configuration = this.configurationService.getValue();
392
- const configSortOrder = configuration?.explorer?.sortOrder || "default" ;
399
+ const configSortOrder = configuration?.explorer?.sortOrder || SortOrder.Default;
393
400
  if (this.config.sortOrder !== configSortOrder) {
394
401
  shouldRefresh = this.config.sortOrder !== undefined;
395
402
  }
396
- const configLexicographicOptions = configuration?.explorer?.sortOrderLexicographicOptions || "default" ;
403
+ const configLexicographicOptions = configuration?.explorer?.sortOrderLexicographicOptions || LexicographicOptions.Default;
397
404
  if (this.config.sortOrderLexicographicOptions !== configLexicographicOptions) {
398
405
  shouldRefresh = shouldRefresh || this.config.sortOrderLexicographicOptions !== undefined;
399
406
  }