Skip to content

Commit c17efa1

Browse files
refactor(clearcache): Delete the LSP cache dir (#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 <nkomonen@amazon.com>
1 parent 2b6aa85 commit c17efa1

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)