-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: clear cache command * chore: lint * fix: use types for Git extension * chore: update CHANGELOG
- Loading branch information
Showing
8 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as vscode from 'vscode'; | ||
|
||
export interface GitExtension { | ||
getAPI(version: number): GitAPI; | ||
} | ||
|
||
export interface GitAPI { | ||
repositories: Repository[]; | ||
} | ||
|
||
export interface Repository { | ||
rootUri: vscode.Uri; | ||
state: RepositoryState; | ||
} | ||
|
||
export interface RepositoryState { | ||
HEAD: Branch | undefined; | ||
onDidChange: vscode.Event<void>; | ||
} | ||
|
||
export interface Branch { | ||
name?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { IVSCodeCommands } from '../vscode/commands'; | ||
import { SNYK_CLEAR_CACHE_COMMAND } from '../constants/commands'; | ||
|
||
export interface IClearCacheService { | ||
clearCache(folderUri?: string, cacheType?: string): Promise<void>; | ||
} | ||
|
||
export class ClearCacheService implements IClearCacheService { | ||
constructor(private commandExecutor: IVSCodeCommands) {} | ||
|
||
async clearCache(folderUri?: string, cacheType?: string): Promise<void> { | ||
try { | ||
const uri = folderUri || ''; | ||
const type = cacheType || ''; | ||
await this.commandExecutor.executeCommand(SNYK_CLEAR_CACHE_COMMAND, uri, type); | ||
} catch (error) { | ||
console.warn(`[ClearCacheService] Failed to clear cache`); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters