Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
- Gracefully recover from failed extension installation
- Move from `nvm` to `mise`
- Provide users a workaround for problems on windows
  • Loading branch information
haberdashPI committed Dec 13, 2024
1 parent 67e23b6 commit 8e0b701
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 44 deletions.
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ If you want to improve your text editing super powers in VSCode, Master Key migh
The easiest way to get started is to activate the built-in keybindings that come with Master Key.

1. Install this extension
2. Run the command `Master Key: Activate Keybindings`
3. Select the built-in binding set "Larkin"
2. On windows only: restart VSCode — there is an [active investigation to avoid this workaround](https://github.com/haberdashPI/vscode-master-key/issues/51).
3. Run the command `Master Key: Activate Keybindings`
4. Select the built-in binding set "Larkin"

> [!WARNING]
> The Larkin keybindings will ask to install some additional extensions. If you choose to install these, one of them, "Rewrap" is not signed by the Marketplace Store. You may have to install this extension manually, rather than using Master Key's UI. Note however that this should not interfere with the activation and use of your keybindings, other than the commands that make use of this specific extension.
You can revert these changes later using `Master Key: Deactivate Keybindings`.

Expand Down Expand Up @@ -244,18 +248,16 @@ And of course, there are many existing editors that Master Key draws inspiration

## Developer Notes

This repository was designed to be worked with in unix-like environments. No effort to support development on Windows has been made. The setup relies on a working version of `nvm` installed in bash and an npm version matching the version specified in `.nvmrc`. You can satisfy this requirement by copying and running the following in bash.
This repository was designed to be worked with in unix-like environments. No effort to support development on Windows has been made. The setup relies on a working version of `mise` installed. You can satisfy this requirement by copying and running the following in bash.

```sh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash # install nvm
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # load nvm
nvm install # install npm version found in `.nvmrc`
curl https://mise.run | sh
```

You can then install all dependencies for this project as follows:

```sh
nvm use
mise activate
mise install
npm ic
```
2 changes: 2 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tools]
node = "20"
5 changes: 1 addition & 4 deletions npm-run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
#!/bin/bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # load nvm
nvm use
mise activate
npm run $@
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Master Key",
"publisher": "haberdashPI",
"description": "Master your keybindings with documentation, discoverability, modal bindings, macros and expressive configuration",
"version": "0.3.12",
"version": "0.3.13",
"icon": "logo.png",
"repository": {
"url": "https://github.com/haberdashPi/vscode-master-key"
Expand Down Expand Up @@ -275,9 +275,5 @@
"string.prototype.replaceall": "^1.0.8",
"zod": "^3.22.4",
"zod-validation-error": "^2.1.0"
},
"main": "./dist/desktop/extension.js",
"env": {
"NODE_ENV": "wdio"
}
}
2 changes: 1 addition & 1 deletion presets/larkin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ requiredExtensions = [
"pustelto.bracketeer",
"wmaurer.change-case",
"pkief.markdown-checkbox",
"stkb.rewrap",
"jack89ita.open-file-from-path",
"koalamer.labeled-bookmarks",
"stkb.rewrap",
]

[[mode]]
Expand Down
25 changes: 0 additions & 25 deletions src/web/keybindings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,6 @@ async function handleRequireExtensions(bindings_?: Bindings) {
if (items.length === 0 || items.every(it => it.detail === 'already installed')) {
return;
}
items.unshift({
label: 'Install All',
picked: false,
});
const picker = vscode.window.createQuickPick();
picker.title = `Extensions Used by ${bindings.name}`;
picker.items = items;
Expand Down Expand Up @@ -516,26 +512,6 @@ async function handleRequireExtensions(bindings_?: Bindings) {
return;
}

if (picker.selectedItems.some(it => it.label === 'Install All')) {
for (const item of picker.items) {
if (item.detail === 'unknown status') {
try {
await vscode.commands.executeCommand(
'workbench.extensions.installExtension',
item.label
);
} catch (e) {
vscode.window.showErrorMessage(
'Error installing extension: ' + item.label
);
console.log('Error installing extension: ' + item.label);
console.dir(e);
throw e;
}
}
}
}

for (const item of picker.selectedItems) {
if (item.detail === 'unknown status') {
try {
Expand All @@ -547,7 +523,6 @@ async function handleRequireExtensions(bindings_?: Bindings) {
vscode.window.showErrorMessage('Error installing extension: ' + item.label);
console.log('Error installing extension: ' + item.label);
console.dir(e);
throw e;
}
}
}
Expand Down

0 comments on commit 8e0b701

Please sign in to comment.