Skip to content

Commit a187a20

Browse files
refactor(clearCache): Delete the LSP cache dir
Sometimes users MAY modify the LSP cache dir for reasons like development, and when we clear all user cache we want to ensure the LSP cache is not corrupted. So when the user calls the clear cache command from the command palette it will also clear the LSP cache too. Signed-off-by: nkomonen-amazon <[email protected]>
1 parent 2b6aa85 commit a187a20

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/amazonq/src/util/clearCache.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { AuthUtil } from 'aws-core-vscode/codewhisperer'
7-
import { Commands, globals } from 'aws-core-vscode/shared'
7+
import { Commands, fs, globals, LanguageServerResolver } from 'aws-core-vscode/shared'
88
import vscode from 'vscode'
99

1010
/**
@@ -40,6 +40,9 @@ async function clearCache() {
4040

4141
await globals.globalState.clear()
4242

43+
// Clear the Language Server Cache
44+
await fs.delete(LanguageServerResolver.defaultDir(), { recursive: true, force: true })
45+
4346
// Make the IDE reload so all new changes take effect
4447
void vscode.commands.executeCommand('workbench.action.reloadWindow')
4548
}

0 commit comments

Comments
 (0)