Skip to content

Commit 54124f0

Browse files
nkomonen-amazontomcat323
authored andcommitted
refactor(clearcache): Delete the LSP cache dir (aws#7361)
Sometimes users MAY modify the LSP cache dir for reasons like development. We have a feature to clear cache, but right now it does not clear the LSP cache. Now we will additionally clear the LSP cache when the user runs the command `Amazon Q: Clear extension cache` --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license. Signed-off-by: nkomonen-amazon <[email protected]>
1 parent 4b1236e commit 54124f0

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
/**
@@ -39,6 +39,9 @@ async function clearCache() {
3939

4040
await globals.globalState.clear()
4141

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

0 commit comments

Comments
 (0)