fileService.ts ×12

Frontier kind: Code frontier

unlabeled · c_10f9f4439dec

243 tests · 11556 LOC · 44 files · introduces 0 tests · 30 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges30 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1839 ranges11556 lines · 44 files · Browse complete extent
All tests (intent)
243 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 30 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/files/common/fileService.ts 30 introduced LOC · 12 ranges

Open complete file

1042
1043 private async doValidateDelete(resource: URI, options?: Partial<IFileDeleteOptions>): Promise<IFileSystemProvider> {
1044 > const provider = this.throwIfFileSystemIsReadonly(await this.withProvider(resource), resource); fileService.ts
1045 >
1046 > // Validate trash support
1047 > const useTrash = !!options?.useTrash;
1048 > if (useTrash && !(provider.capabilities & FileSystemProviderCapabilities.Trash)) {
1049 throw new Error(localize('deleteFailedTrashUnsupported', "Unable to delete file '{0}' via trash because provider does not support it.", this.resourceForError(resource)));
1050 }
1052 > // Validate atomic support
1053 > const atomic = options?.atomic;
1054 > if (atomic && !(provider.capabilities & FileSystemProviderCapabilities.FileAtomicDelete)) {
1055 throw new Error(localize('deleteFailedAtomicUnsupported', "Unable to delete file '{0}' atomically because provider does not support it.", this.resourceForError(resource)));
1056 }
1058 > if (useTrash && atomic) {
1059 throw new Error(localize('deleteFailedTrashAndAtomicUnsupported', "Unable to atomically delete file '{0}' because using trash is enabled.", this.resourceForError(resource)));
1060 }
1062 > // Validate delete
1063 > let stat: IStat | undefined = undefined;
1064 > try {
1065 > stat = await provider.stat(resource);
1066 > } catch (error) {
1067 // Handled later
1068 }
1070 > if (stat) {
1071 this.throwIfFileIsReadonly(resource, stat);
1072 > } else { fileService.ts
1073 throw new FileOperationError(localize('deleteFailedNotFound', "Unable to delete nonexistent file '{0}'", this.resourceForError(resource)), FileOperationResult.FILE_NOT_FOUND);
1074 }
1076 // Validate recursive
1077 const recursive = !!options?.recursive;
1078 > if (!recursive) { fileService.ts
1079 const stat = await this.resolve(resource);
1080 if (stat.isDirectory && Array.isArray(stat.children) && stat.children.length > 0) {
1084
1085 return provider;
1086 > } fileService.ts
1087
1088 async del(resource: URI, options?: Partial<IFileDeleteOptions>): Promise<void> {
1089 > const provider = await this.doValidateDelete(resource, options); fileService.ts
1090
1091 let deleteFileOptions = options;
1092 > if (hasFileAtomicDeleteCapability(provider) && !deleteFileOptions?.atomic) { fileService.ts
1093 const enforcedAtomicDelete = provider.enforceAtomicDelete?.(resource);
1094 if (enforcedAtomicDelete) {
1098
1099 const useTrash = !!deleteFileOptions?.useTrash;
1100 > const recursive = !!deleteFileOptions?.recursive; fileService.ts
1101 > const atomic = deleteFileOptions?.atomic ?? false;
1102 >
1103 > // Delete through provider
1104 > await provider.delete(resource, { recursive, useTrash, atomic });
1105
1106 // Events
1107 this._onDidRunOperation.fire(new FileOperationEvent(resource, FileOperation.DELETE));
1108 > } fileService.ts
1109
1110 //#endregion