Skip to content

Conversation

@Huliiiiii
Copy link
Contributor

@Huliiiiii Huliiiiii commented Sep 8, 2025

Not implemented:

  • j: Open jumplist picker
  • ': Open last picker

  • d: Open diagnostic picker
    VS Code doesn’t have a single-file diagnostic picker, so it currently behaves the same as D.

The window menu was copied directly from Silverquark’s fork.

@Huliiiiii Huliiiiii changed the title Add space menu Add space menu and window menu Sep 8, 2025
@Huliiiiii Huliiiiii force-pushed the space branch 6 times, most recently from 4e3f332 to 314bfbf Compare September 8, 2025 23:43
Copy link
Owner

@71 71 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! A couple minor comments.

);
`.split("\n").map(line => line.trim()).join(""),
],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you can also keep this as an array to be more readable (also removing the opening [)

Suggested change
],
`.trim().split("\n"),

To remove the indentation, I would do .replaceAll(/^ {,18}/mg, "") or something like this to preserve the "internal" indentation.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if that wasn't clear, I meant writing the text multiline using a template literal

code: `
  if (...) {
    ...
  }`.replaceAll(/^ {,2}/mg, "")

This way it is a multiline string which is easy to read and edit in package.build.ts, and in the generated package.json it is an array of lines which is similarly easy to read (but less so than a multiline string).

Comment on lines 311 to 318
const quickOpenPrefix = relativeDirectoryPath.endsWith('/')
? relativeDirectoryPath
: \`\${relativeDirectoryPath}/\`;
await vscode.commands.executeCommand(
'workbench.action.quickOpen',
quickOpenPrefix
);
Copy link
Owner

@71 71 Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's a neat idea!

Comment on lines 489 to 497
// "n": { Not easily possible. Neccessary?
// text: "New split scratch buffer",
// command: "",
// },
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to do it here, but perhaps we can check if the editor has horizontal / vertical splits already (maybe with vscode.window.tabGroups?), create them if needed (maybe vscode.window.showTextDocument() or using View: Split Editor), and then an empty file there? Also I'm not sure all of these steps are possible.

Copy link
Owner

@71 71 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nits, but also the confusing indentation made us miss a problem: the window menu is defined within the space object, so we can't actually open it with w.

);
`.split("\n").map(line => line.trim()).join(""),
],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if that wasn't clear, I meant writing the text multiline using a template literal

code: `
  if (...) {
    ...
  }`.replaceAll(/^ {,2}/mg, "")

This way it is a multiline string which is easy to read and edit in package.build.ts, and in the generated package.json it is an array of lines which is similarly easy to read (but less so than a multiline string).

- Add ES2021.String to lib because replaceAll requires it
@Huliiiiii Huliiiiii requested a review from 71 September 27, 2025 13:49
@Huliiiiii
Copy link
Contributor Author

I don't understand why CI failed, but it should have followed the indentation correctly.
(The key "dance.menus" is indented with 4 spaces, and "space" is indented with 6 spaces.)

@71
Copy link
Owner

71 commented Oct 1, 2025

I don't understand why CI failed, but it should have followed the indentation correctly.

I think it wants the "following lines" to be indented wrt the property being defined. This fixed it for me:

diff --git a/extensions/helix/package.build.ts b/extensions/helix/package.build.ts
index 221ba72..d29a928 100644
--- a/extensions/helix/package.build.ts
+++ b/extensions/helix/package.build.ts
@@ -307,10 +307,10 @@ export const pkg = (modules: Builder.ParsedModule[]) => ({
                     'workbench.action.quickOpen',
                     quickOpenPrefix,
                   );`
-                  // The indentation of multi-line template strings
-                  .replaceAll("                  ", "")
-                  .replaceAll(/^ {,2}/mg, "")
-                  .split("\n")
+                    // The indentation of multi-line template strings
+                    .replaceAll("                  ", "")
+                    .replaceAll(/^ {,2}/mg, "")
+                    .split("\n")
                 ,
               },
             ],

As a small nit (since we need to change this code anyway), I think the following is a bit more readable:

diff --git a/extensions/helix/package.build.ts b/extensions/helix/package.build.ts
index 221ba72..7588f4a 100644
--- a/extensions/helix/package.build.ts
+++ b/extensions/helix/package.build.ts
@@ -307,10 +307,9 @@ export const pkg = (modules: Builder.ParsedModule[]) => ({
                     'workbench.action.quickOpen',
                     quickOpenPrefix,
                   );`
-                  // The indentation of multi-line template strings
-                  .replaceAll("                  ", "")
-                  .replaceAll(/^ {,2}/mg, "")
-                  .split("\n")
+                    // The indentation of multi-line template strings
+                    .replaceAll(" ".repeat(18), "")
+                    .split("\n")
                 ,
               },
             ],

There is another edge case with F: if the current file is in the workspace root directory, then asRelativePath() returns the input fsPath, i.e. an absolute path that VS Code does not provide autocompletion for. The following fixes it:

diff --git a/extensions/helix/package.build.ts b/extensions/helix/package.build.ts
index 221ba72..3f4ddfa 100644
--- a/extensions/helix/package.build.ts
+++ b/extensions/helix/package.build.ts
@@ -295,7 +295,7 @@ export const pkg = (modules: Builder.ParsedModule[]) => ({
                   const currentFileUri = editor.document.uri;
                   const currentDirectoryUri = vscode.Uri.joinPath(currentFileUri, '..');
                   const workspaceFolder = vscode.workspace.getWorkspaceFolder(currentFileUri);
-                  if (!workspaceFolder) {
+                  if (!workspaceFolder || currentDirectoryUri.fsPath === workspaceFolder.uri.fsPath) {
                     return await fallback();
                   }
                   const relativeDirectoryPath = vscode.workspace.asRelativePath(

@Huliiiiii
Copy link
Contributor Author

Huliiiiii commented Oct 1, 2025

Thanks for your suggestion, but I've found a better way to get the indentation.

Copy link
Owner

@71 71 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@71 71 merged commit 546d09c into 71:master Oct 3, 2025
2 checks passed
@Huliiiiii Huliiiiii deleted the space branch October 3, 2025 09:02
71 pushed a commit that referenced this pull request Oct 7, 2025
This keybinding seems to have been forgotten in #402

Co-authored-by: jgdhs27 <jgdhs27@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants