Skip to content

Commit

Permalink
PR Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Strackeror committed Jul 18, 2024
1 parent 91bc9d6 commit 10e50a9
Show file tree
Hide file tree
Showing 13 changed files with 146 additions and 123 deletions.
3 changes: 1 addition & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
"outFiles": ["${workspaceFolder}/out/**/*.js"],
},
{
"name": "Launch extension with helix keybinds",
"name": "Launch extension with Helix keybindings",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/.vscode-test",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionDevelopmentPath=${workspaceFolder}/extensions/helix/",
],
Expand Down
17 changes: 12 additions & 5 deletions extensions/helix/package.build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { Builder, generateIgnoredKeybinds } from "../../meta";
import * as fs from "fs/promises";
import { SelectionBehavior } from "../../src/api";
import { extensionId } from "../../src/utils/constants";

const version = "0.1.0",
preRelease = 1,
Expand All @@ -14,16 +14,23 @@ export const pkg = (modules: Builder.ParsedModule[]) => ({
// Common package.json properties.
// ==========================================================================

name: "dance-helix-keybinds",
description: "Helix keybindings for dance",
name: "dance-helix-keybindingss",
description: "Helix keybindings for Dance",
version,
license: "ISC",

extensionDependencies: [extensionId],
author: {
name: "Grégoire Geis",
email: "[email protected]",
},

contributors: [
{
name: "Rémi Lavergne",
url: "https://github.com/Strackeror",
},
],

repository: {
type: "git",
url: "https://github.com/71/dance.git",
Expand All @@ -33,7 +40,7 @@ export const pkg = (modules: Builder.ParsedModule[]) => ({
vscode: "^1.63.0",
},

displayName: "Dance",
displayName: "Dance (Helix keybindings)",
publisher: "gregoire",
categories: ["Keymaps", "Other"],
readme: "README.md",
Expand Down
10 changes: 8 additions & 2 deletions extensions/helix/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,13 @@ function getKeybindings(module: Omit<Builder.ParsedModule, "keybindings">): Buil
].sort((a, b) => a.command.localeCompare(b.command));
}

/**
* Takes a list of keybindings and generates `dance.ignore` keybindings for
* common keys that are unused. This is used for modes where we don't want the
* user to be able to type
*/
export function generateIgnoredKeybinds(
currentKeybindings: Builder.Keybinding[],
currentKeybindings: readonly Builder.Keybinding[],
when: string,
): Builder.Keybinding[] {
const alphanum = [..."ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"],
Expand Down
10 changes: 7 additions & 3 deletions package.build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const builtinModesAreDeprecatedMessage =
"Built-in modes are deprecated. Use `#dance.modes#` instead.";

const modeNamePattern = {
pattern: /^[a-zA-Z]\w*\/?\w*$/.source,
pattern: /^[a-zA-Z]\w*(\/\w+)?$/.source,
patternErrorMessage: "",
};

Expand Down Expand Up @@ -129,7 +129,11 @@ export const pkg = (modules: Builder.ParsedModule[]) => ({
"publish": "vsce publish --allow-star-activation",
"package:pre": `vsce package --allow-star-activation --pre-release --no-git-tag-version --no-update-package-json ${version.replace(/\d+$/, "$&" + preRelease.toString().padStart(3, "0"))}`,
"publish:pre": `vsce publish --allow-star-activation --pre-release --no-git-tag-version --no-update-package-json ${version.replace(/\d+$/, "$&" + preRelease.toString().padStart(3, "0"))}`,
"package-helix": `cd extensions/helix && npm run package`,

"package-helix": `cd extensions/helix && yarn run package`,
"publish-helix": `cd extensions/helix && yarn run publish`,
"package-helix:pre": `cd extensions/helix && yarn run package:pre`,
"publish-helix:pre": `cd extensions/helix && yarn run publish:pre`,
},

devDependencies: {
Expand Down Expand Up @@ -763,7 +767,7 @@ export const pkg = (modules: Builder.ParsedModule[]) => ({

return [
...keybindings,
...generateIgnoredKeybinds(keybindings,`editorTextFocus && dance.mode == 'normal'`),
...generateIgnoredKeybinds(keybindings, `editorTextFocus && dance.mode == 'normal'`),
];
})(),

Expand Down
11 changes: 7 additions & 4 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/api/data/commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1814,15 +1814,15 @@ select.line.below.extend:
title:
en: Extend to line below

doc:
en: |
Extend to line below.
keys:
qwerty: |-
`x` (helix: normal)
`x` (helix: select)
doc:
en: |+
Extend to line below.
select.lineEnd:
title:
en: Select to line end
Expand Down Expand Up @@ -2759,7 +2759,7 @@ anonymous:
en: Open match menu with extend

commands: |-
[".openMenu", { menu: "match", pass: [{shift: "extend"}] }]
[".openMenu", { menu: "match", pass: [{ shift: "extend" }] }]
keys:
qwerty: |-
Expand Down
9 changes: 2 additions & 7 deletions src/api/modes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,10 @@ function findMode(modeName: string, context?: Context) {
split = currentMode.name.split("/");
if (split.length === 2) {
const namespacedMode = context.extension.modes.get(`${split[0]}/${modeName}`);
if (namespacedMode) {
if (namespacedMode !== undefined) {
return namespacedMode;
}
}

const directMode = context.extension.modes.get(modeName);
if (directMode) {
return directMode;
}

return undefined;
return context.extension.modes.get(modeName);
}
61 changes: 31 additions & 30 deletions src/commands/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 10e50a9

Please sign in to comment.