Skip to content

Add workspace clean command to delete classpath cache #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
"command": "kotlin.overrideMember",
"title": "Override member(s)",
"category": "Kotlin"
},
{
"command": "kotlin.clean.workspace",
"title": "Clean Kotlin Language Server workspace",
"category": "Kotlin"
}
],
"menus": {
Expand Down
18 changes: 18 additions & 0 deletions src/languageSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,24 @@ export async function activateLanguageServer({ context, status, config, javaInst
});
});

vscode.commands.registerCommand("kotlin.clean.workspace", async (force?: boolean) => {
if (!force) {
const message = 'Are you sure you want to clean the Kotlin language server workspace?';
const cancel = 'Cancel';
const doIt = 'Reload and delete';
const selection = await vscode.window.showWarningMessage(message, cancel, doIt);
if (selection !== doIt) { // user cancelled
return;
}
}

// remove the workspace
fs.rmdirSync(storagePath, { recursive: true });

// reload the window
vscode.commands.executeCommand("workbench.action.reloadWindow");
});

// Activating run/debug code lens if the debug adapter is enabled
// and we are using 'kotlin-language-server' (other language servers
// might not support the non-standard 'kotlin/mainClass' request)
Expand Down