-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
65 additions
and
32 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import * as vscode from "vscode"; | ||
import * as fsp from "fs/promises"; | ||
import * as path from "path"; | ||
import * as os from "os"; | ||
|
||
export const run = async (cacheDir: string) => { | ||
if (cacheDir[0] === "~") { | ||
cacheDir = path.join(os.homedir(), cacheDir.slice(1)); | ||
} | ||
const bin = path.join(cacheDir, "nextls"); | ||
await fsp | ||
.rm(bin) | ||
.then( | ||
async () => | ||
await vscode.window.showInformationMessage( | ||
`Uninstalled Next LS from ${bin}` | ||
) | ||
) | ||
.catch( | ||
async (error) => | ||
await vscode.window.showErrorMessage( | ||
`Failed to uninstall Next LS from ${bin} due to ${error}` | ||
) | ||
); | ||
}; | ||
|
||
const registerUninstallCommand = ( | ||
config: vscode.WorkspaceConfiguration, | ||
context: vscode.ExtensionContext | ||
) => { | ||
const uninstallCommand = "elixir-tools.uninstall-nextls"; | ||
|
||
const uninstall = async () => | ||
run(<string>config.get("installationDirectory")); | ||
|
||
context.subscriptions.push( | ||
vscode.commands.registerCommand(uninstallCommand, uninstall) | ||
); | ||
}; | ||
|
||
export default registerUninstallCommand; |
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