@@ -285,30 +285,35 @@ export const pkg = (modules: Builder.ParsedModule[]) => ({
285285 args : [
286286 {
287287 code : [
288- "const editor = vscode.window.activeTextEditor;" ,
289- "if (!editor) { return; }" ,
290- "const currentFileUri = editor.document.uri;" ,
291- "" ,
292- "const currentDirectoryUri = vscode.Uri.joinPath(currentFileUri, '..');" ,
293- "" ,
294- "const workspaceFolder = vscode.workspace.getWorkspaceFolder(currentFileUri);" ,
295- "if (workspaceFolder) {" ,
296- "" ,
297- " const relativeDirectoryPath = vscode.workspace.asRelativePath(currentDirectoryUri);" ,
298- "" ,
299- " const quickOpenPrefix = relativeDirectoryPath.endsWith('/')" ,
300- " ? relativeDirectoryPath" ,
301- " : `${relativeDirectoryPath}/`;" ,
302- "" ,
303- " await vscode.commands.executeCommand(" ,
304- " 'workbench.action.quickOpen'," ,
305- " quickOpenPrefix" ,
306- " );" ,
307- "} else {" ,
308- " await vscode.commands.executeCommand(" ,
309- " 'workbench.action.quickOpen'" ,
310- " );" ,
311- "}" ,
288+ `
289+ const editor = vscode.window.activeTextEditor;
290+ const fallback = () => vscode.commands.executeCommand(
291+ 'workbench.action.quickOpen',
292+ );
293+
294+ if (!editor) {
295+ return await fallback();
296+ }
297+
298+ const currentFileUri = editor.document.uri;
299+ const currentDirectoryUri = vscode.Uri.joinPath(currentFileUri, '..');
300+
301+ const workspaceFolder = vscode.workspace.getWorkspaceFolder(currentFileUri);
302+ if (workspaceFolder) {
303+ const relativeDirectoryPath = vscode.workspace.asRelativePath(currentDirectoryUri);
304+
305+ const quickOpenPrefix = relativeDirectoryPath.endsWith('/')
306+ ? relativeDirectoryPath
307+ : \`\${relativeDirectoryPath}/\`;
308+
309+ await vscode.commands.executeCommand(
310+ 'workbench.action.quickOpen',
311+ quickOpenPrefix
312+ );
313+
314+ } else {
315+ return await fallback();
316+ }` . split ( "\n" ) . map ( line => line . trim ( ) ) . join ( "" ) ,
312317 ] ,
313318 } ,
314319 ] ,
@@ -348,7 +353,8 @@ export const pkg = (modules: Builder.ParsedModule[]) => ({
348353 } ,
349354 "w" : {
350355 text : "Window" ,
351- command : "dance.window.windowMenu" ,
356+ command : "dance.openMenu" ,
357+ args : [ { menu : "window" } ] ,
352358 } ,
353359 "y" : {
354360 text : "Yank selections to clipboard" ,
@@ -408,6 +414,80 @@ export const pkg = (modules: Builder.ParsedModule[]) => ({
408414 command : "editor.action.referenceSearch.trigger" ,
409415 } ,
410416 } ,
417+
418+ "window" : {
419+ title : "Window" ,
420+ items : {
421+ "w" : {
422+ text : "Goto next window" ,
423+ command : "workbench.action.nextEditor" ,
424+ } ,
425+ "s" : {
426+ text : "Horizontal bottom split" ,
427+ command : "workbench.action.splitEditorDown" ,
428+ } ,
429+ "v" : {
430+ text : "Vertical right split" ,
431+ command : "workbench.action.splitEditor" ,
432+ } ,
433+ "t" : {
434+ text : "Transpose splits" ,
435+ command : "workbench.action.toggleEditorGroupLayout" ,
436+ } ,
437+ // "f": {
438+ // text: "Open files in selection (hsplit)",
439+ // command: "dance.selections.open", function needs to be modified
440+ // },
441+ // "F": {
442+ // text: "Open files in selection (vsplit)",
443+ // command: "dance.selections.open", function needs to be modified
444+ // },
445+ "q" : {
446+ text : "Close window" ,
447+ command : "workbench.action.closeActiveEditor" ,
448+ } ,
449+ "o" : {
450+ text : "Close all other windows (Current window only)" ,
451+ command : "workbench.action.closeOtherEditors" ,
452+ } ,
453+ "h" : {
454+ text : "Jump to the split on the left" ,
455+ command : "workbench.action.focusLeftGroup" ,
456+ } ,
457+ "j" : {
458+ text : "Jump to the split below" ,
459+ command : "workbench.action.focusBelowGroup" ,
460+ } ,
461+ "k" : {
462+ text : "Jump to the split above" ,
463+ command : "workbench.action.focusAboveGroup" ,
464+ } ,
465+ "l" : {
466+ text : "Jump to the split to the right" ,
467+ command : "workbench.action.focusRightGroup" ,
468+ } ,
469+ "H" : {
470+ text : "Swap with the split to the left" ,
471+ command : "workbench.action.moveActiveEditorGroupLeft" ,
472+ } ,
473+ "J" : {
474+ text : "Swap with the split below" ,
475+ command : "workbench.action.moveActiveEditorGroupDown" ,
476+ } ,
477+ "K" : {
478+ text : "Swap with the split above" ,
479+ command : "workbench.action.moveActiveEditorGroupUp" ,
480+ } ,
481+ "L" : {
482+ text : "Swap with the split to the right" ,
483+ command : "workbench.action.moveActiveEditorGroupRight" ,
484+ } ,
485+ // "n": { Not easily possible. Neccessary?
486+ // text: "New split scratch buffer",
487+ // command: "",
488+ // },
489+ } ,
490+ } ,
411491 } ,
412492 } ,
413493 } ,
0 commit comments