MCPcopy Create free account
hub / github.com/dethcrypto/dethcode / rename

Method rename

packages/ethereum-viewer/src/fs/fileSystemProvider.ts:115–138  ·  view source on GitHub ↗
(
    oldUri: vscode.Uri,
    newUri: vscode.Uri,
    options: { overwrite: boolean }
  )

Source from the content-addressed store, hash-verified

113 // --- manage files/folders
114
115 rename(
116 oldUri: vscode.Uri,
117 newUri: vscode.Uri,
118 options: { overwrite: boolean }
119 ): void {
120 if (!options.overwrite && this._lookup(newUri, true)) {
121 throw vscode.FileSystemError.FileExists(newUri);
122 }
123
124 const entry = this._lookup(oldUri, false);
125 const oldParent = this._lookupParentDirectory(oldUri);
126
127 const newParent = this._lookupParentDirectory(newUri);
128 const newName = path.posix.basename(newUri.path);
129
130 oldParent.entries.delete(entry.name);
131 entry.name = newName;
132 newParent.entries.set(newName, entry);
133
134 this._fireSoon(
135 { type: vscode.FileChangeType.Deleted, uri: oldUri },
136 { type: vscode.FileChangeType.Created, uri: newUri }
137 );
138 }
139
140 delete(uri: vscode.Uri): void {
141 const dirname = uri.with({ path: path.posix.dirname(uri.path) });

Callers

nothing calls this directly

Calls 4

_lookupMethod · 0.95
_fireSoonMethod · 0.95
deleteMethod · 0.65

Tested by

no test coverage detected