Skip to content

Commit 28f71b4

Browse files
authored
refactor: no string arg in watchedFiles.remove() #2943
1 parent 63d19e9 commit 28f71b4

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

src/shared/cloudformation/templateRegistry.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ export class CloudFormationTemplateRegistry extends WatchedFiles<CloudFormation.
6464
type: 'yaml',
6565
schema: undefined,
6666
})
67-
const path = normalizeVSCodeUri(uri)
68-
await super.remove(path)
67+
await super.remove(uri)
6968
}
7069
}
7170

src/shared/watchedFiles.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,13 @@ export abstract class WatchedFiles<T> implements vscode.Disposable {
193193

194194
/**
195195
* Removes an item from the registry.
196-
* @param absolutePath The absolute path to the item or a vscode.Uri to the item
196+
*
197+
* @param path Path to the item
197198
*/
198-
public async remove(path: string | vscode.Uri): Promise<void> {
199-
if (typeof path === 'string') {
200-
this.registryData.delete(path)
201-
} else {
202-
const pathAsString = normalizeVSCodeUri(path)
203-
this.assertAbsolute(pathAsString)
204-
this.registryData.delete(pathAsString)
205-
}
199+
public async remove(path: vscode.Uri): Promise<void> {
200+
const pathAsString = normalizeVSCodeUri(path)
201+
this.assertAbsolute(pathAsString)
202+
this.registryData.delete(pathAsString)
206203
}
207204

208205
/**

src/test/shared/cloudformation/templateRegistry.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe('CloudFormation Template Registry', async function () {
9696
await testRegistry.addItemToRegistry(vscode.Uri.file(filename.fsPath))
9797
assert.strictEqual(testRegistry.registeredItems.length, 1)
9898

99-
await testRegistry.remove(vscode.Uri.file(filename.fsPath))
99+
await testRegistry.remove(filename)
100100
assert.strictEqual(testRegistry.registeredItems.length, 0)
101101
})
102102

0 commit comments

Comments
 (0)