Skip to content

Commit

Permalink
v1.4.0 - Added titles to dialogs for
Browse files Browse the repository at this point in the history
 all commands.
  • Loading branch information
robole committed Apr 5, 2023
1 parent 260026c commit c986931
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 58 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ All notable changes to this project are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/-0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.4.0] - 2023-03-05

### Added

- Added a title to the dropdown of all commands to clearly identify the command being run. It was added for the following commands:
- Open File,
- Open File to the Right,
- Open File to the Left,
- Open File Above,
- Open File Below,
- Open File in External Default App

### Changed

- Changed the title to include *step name (field changed)* to clearly identify the value being requested/edited. Now the title is in the form of "<command name> - <step name> - <cumlative value from previous steps>". This was changed for the following commands:
- Duplicate Active File,
- Duplicate File,
- Move File,
- Create New File,
- Create New Folder
- Changed wording of some titles and placeholder text to be more consistently phrased.

## [1.3.7] - 2023-03-05

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"description": "Perform file actions quickly with keyboard-driven file selection. 🐰⌨️",
"icon": "img/logo.png",
"version": "1.3.7",
"version": "1.4.0",
"engines": {
"vscode": "^1.46.0",
"node": ">=12"
Expand Down
15 changes: 7 additions & 8 deletions src/duplicateActiveFilePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ const util = require("./util");
class DuplicateActiveFilePicker extends MultiStepPicker {
constructor() {
let steps = [
new Step(1, `Duplicate Active File`, "Pick a location", []),
new Step(1, `Duplicate Active File - location`, "Pick a location", []),
new Step(
2,
`Duplicate Active File`,
"Type a filename",
`Duplicate Active File - name`,
"Enter a name",
[],
[vscode.QuickInputButtons.Back]
),
Expand All @@ -27,7 +27,7 @@ class DuplicateActiveFilePicker extends MultiStepPicker {
this.fileName = nodePath.basename(
vscode.window.activeTextEditor.document.fileName
);
this.steps[0].title = `Duplicate '${this.fileName}'`;

this.steps[1].value = this.fileName;

if (util.isWorkspaceOpen()) {
Expand Down Expand Up @@ -77,10 +77,9 @@ class DuplicateActiveFilePicker extends MultiStepPicker {
this.picker.value = "";

this.currentStepNum = 2;
this.steps[1].title = `Duplicate '${this.fileName}' to '${nodePath.join(
selection,
this.steps[1].title = `Duplicate Active File - name - '${
this.fileName
)}'`;
}' to '${nodePath.join(selection, this.fileName)}'`;
this.setCurrentStep(this.steps[1]);
} else if (this.currentStepNum === 2) {
this.steps[1].value = currentValue;
Expand Down Expand Up @@ -115,7 +114,7 @@ class DuplicateActiveFilePicker extends MultiStepPicker {
}

setTitle(filepath) {
this.picker.title = `Duplicate '${this.fileName}' to '${filepath}'`;
this.picker.title = `Duplicate Active File - name - '${this.fileName}' to '${filepath}'`;
}

async duplicateFile() {
Expand Down
14 changes: 7 additions & 7 deletions src/duplicateFilePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ const util = require("./util");
class DuplicateFilePicker extends MultiStepPicker {
constructor() {
let steps = [
new Step(1, `Duplicate File`, "Pick a file to duplicate", []),
new Step(1, `Duplicate File - file`, "Pick a file", []),
new Step(
2,
`Duplicate File`,
`Duplicate File - location`,
"Pick a location",
[],
[vscode.QuickInputButtons.Back]
),
new Step(
3,
`Duplicate File`,
"Type a filename",
`Duplicate File - name`,
"Enter a name",
[],
[vscode.QuickInputButtons.Back]
),
Expand Down Expand Up @@ -84,14 +84,14 @@ class DuplicateFilePicker extends MultiStepPicker {
this.steps[0].value = selection;
this.picker.value = "";

this.steps[1].title = `Duplicate '${this.steps[0].value}' to`;
this.steps[1].title = `Duplicate File - location - '${this.steps[0].value}' to?`;

this.goForward();
} else if (this.currentStepNum === 2) {
let selection = pickedItems[0].name;
this.steps[1].value = selection;

this.steps[2].title = `Duplicate '${this.steps[0].value}' to '${this.steps[1].value}'`;
this.steps[2].title = `Duplicate File - name - '${this.steps[0].value}' to '${this.steps[1].value}'`;
this.steps[2].value = nodePath.basename(this.steps[0].value); // only want filename from step 1

this.goForward();
Expand All @@ -111,7 +111,7 @@ class DuplicateFilePicker extends MultiStepPicker {
}

setTitle(from, to) {
this.picker.title = `Duplicate '${from}' to '${to}'`;
this.picker.title = `Duplicate File - name - '${from}' to '${to}'`;
}

async duplicateFile() {
Expand Down
23 changes: 13 additions & 10 deletions src/fileAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async function openFile() {
return;
}

let selectedFile = await selectWorkspaceFile();
let selectedFile = await selectWorkspaceFile("Open File");

if (selectedFile !== undefined) {
await vscode.commands.executeCommand("vscode.open", selectedFile);
Expand All @@ -37,7 +37,9 @@ async function openFileExternal() {
return;
}

let selectedFile = await selectWorkspaceFile();
let selectedFile = await selectWorkspaceFile(
"Open File in External Default App"
);

if (selectedFile !== undefined) {
try {
Expand Down Expand Up @@ -67,7 +69,7 @@ async function openFileAbove() {
return;
}

let selectedFile = await selectWorkspaceFile();
let selectedFile = await selectWorkspaceFile("Open File Above");

if (selectedFile !== undefined) {
await vscode.commands.executeCommand("workbench.action.splitEditorUp");
Expand All @@ -83,7 +85,7 @@ async function openFileBelow() {
return;
}

let selectedFile = await selectWorkspaceFile();
let selectedFile = await selectWorkspaceFile("Open File Below");

if (selectedFile !== undefined) {
await vscode.commands.executeCommand("workbench.action.splitEditorDown");
Expand All @@ -99,7 +101,7 @@ async function openFileToRight() {
return;
}

let selectedFile = await selectWorkspaceFile();
let selectedFile = await selectWorkspaceFile("Open File to the Right");

if (selectedFile !== undefined) {
await vscode.commands.executeCommand("workbench.action.splitEditorRight");
Expand All @@ -115,7 +117,7 @@ async function openFileToLeft() {
return;
}

let selectedFile = await selectWorkspaceFile();
let selectedFile = await selectWorkspaceFile("Open File to the Left");

if (selectedFile !== undefined) {
await vscode.commands.executeCommand("workbench.action.splitEditorLeft");
Expand All @@ -126,7 +128,7 @@ async function openFileToLeft() {
}
}

async function selectWorkspaceFile() {
async function selectWorkspaceFile(title = "") {
if (util.isWorkspaceOpen() === false) {
return undefined;
}
Expand All @@ -143,7 +145,8 @@ async function selectWorkspaceFile() {

let selectedFile = await vscode.window.showQuickPick(pickerItems, {
ignoreFocusOut: true,
placeHolder: `Open file`,
placeHolder: `Pick a file`,
title,
});

if (selectedFile !== undefined) {
Expand Down Expand Up @@ -179,7 +182,7 @@ async function moveActiveFile() {
let selectedFolder = await vscode.window.showQuickPick(pickerItems, {
ignoreFocusOut: true,
placeHolder: `Pick a location`,
title: `Move file`,
title: `Move Active File`,
});

if (selectedFolder !== undefined) {
Expand Down Expand Up @@ -224,7 +227,7 @@ async function renameActiveFile() {

let newName = await vscode.window.showInputBox({
value: name,
prompt: `Rename file: ${getRelativePathOfActiveFile()}`,
prompt: `Rename Active File - '${getRelativePathOfActiveFile()}'`,
});

if (
Expand Down
12 changes: 8 additions & 4 deletions src/folderAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function duplicateFolder() {

async function deleteFolder() {
if (vscode.workspace.workspaceFolders) {
let selectedFolder = await selectWorkspaceFolder(false);
let selectedFolder = await selectWorkspaceFolder(false, "Delete Folder");

if (selectedFolder !== undefined) {
let newUri = vscode.Uri.file(selectedFolder.path);
Expand All @@ -106,7 +106,10 @@ async function openWorkspaceFolderExternal() {
}

async function openFolderExternal() {
let selectedFolder = await selectWorkspaceFolder(false);
let selectedFolder = await selectWorkspaceFolder(
false,
"Open Workspace Folder in External Default App"
);

if (selectedFolder !== undefined) {
try {
Expand All @@ -118,7 +121,7 @@ async function openFolderExternal() {
}
}

async function selectWorkspaceFolder(includeTopFolder = true) {
async function selectWorkspaceFolder(includeTopFolder = true, title = "") {
if (vscode.workspace.workspaceFolders === undefined) {
return undefined;
}
Expand All @@ -139,7 +142,8 @@ async function selectWorkspaceFolder(includeTopFolder = true) {

let selectedFolder = await vscode.window.showQuickPick(pickerItems, {
ignoreFocusOut: true,
placeHolder: `Choose folder`,
placeHolder: `Pick a folder`,
title,
});

return selectedFolder;
Expand Down
22 changes: 3 additions & 19 deletions src/moveFilePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const util = require("./util");
class MoveFilePicker extends MultiStepPicker {
constructor() {
let steps = [
new Step(1, `Move File`, "Pick a file to move", []),
new Step(1, `Move File - file`, "Pick a file", []),
new Step(
2,
`Move File`,
`Move File - location`,
"Pick a location",
[],
[vscode.QuickInputButtons.Back]
Expand All @@ -27,11 +27,6 @@ class MoveFilePicker extends MultiStepPicker {
if (util.isWorkspaceOpen()) {
this.rootFolder = vscode.workspace.workspaceFolders[0].uri.fsPath;
}

let disposable1 = this.picker.onDidChangeValue(
this.onDidChangeValue.bind(this)
);
this.disposables.push(disposable1);
}

async run() {
Expand Down Expand Up @@ -78,7 +73,7 @@ class MoveFilePicker extends MultiStepPicker {
this.steps[0].value = selection;
this.picker.value = "";

this.steps[1].title = `Move '${selection}' to`;
this.steps[1].title = `Move File - location - '${selection}'`;

this.goForward();
} else if (this.currentStepNum === 2) {
Expand Down Expand Up @@ -106,17 +101,6 @@ class MoveFilePicker extends MultiStepPicker {
}
}

onDidChangeValue(newValue) {
if (this.currentStepNum === 2) {
let newFilePath = nodePath.join(this.steps[1].value, newValue);
this.setTitle(this.steps[0].value, newFilePath);
}
}

setTitle(from, to) {
this.picker.title = `Move '${from}' to '${to}'`;
}

async moveFile() {
let sourceUri = vscode.Uri.file(
nodePath.join(this.rootFolder, this.steps[0].value)
Expand Down
8 changes: 4 additions & 4 deletions src/newFilePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ const configuration = require("./configuration");
class NewFilePicker extends MultiStepPicker {
constructor() {
let steps = [
new Step(1, "Create a new file", "Pick a location"),
new Step(1, "Create New File - location", "Pick a location"),
new Step(
2,
"Create a new file",
"Type a filename (use left arrow key to return to previous step)",
"Create New File - name",
"Enter a name",
[],
[vscode.QuickInputButtons.Back]
),
Expand Down Expand Up @@ -107,7 +107,7 @@ class NewFilePicker extends MultiStepPicker {
}

setTitle(filepath) {
this.picker.title = `Create a new file: "${filepath}"`;
this.picker.title = `Create New File - name - "${filepath}"`;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/newFolderPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ const configuration = require("./configuration");
class NewFolderPicker extends MultiStepPicker {
constructor() {
let steps = [
new Step(1, "Create a new folder", "Pick a location"),
new Step(1, "Create New Folder - Location", "Pick a location"),
new Step(
2,
"Create a new folder",
"Type a name (use left arrow key to return to previous step)",
"Create New Folder - Name",
"Enter a name",
[],
[vscode.QuickInputButtons.Back]
),
Expand Down Expand Up @@ -95,7 +95,7 @@ class NewFolderPicker extends MultiStepPicker {
}

setTitle(filepath) {
this.picker.title = `Create a new folder: "${filepath}"`;
this.picker.title = `Create New Folder - name - '${filepath}'`;
}
}

Expand Down
4 changes: 3 additions & 1 deletion todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

## Tasks

1. For `Move File` - cease opening the file at the end of the action?
1. Add command name to title for `Open Folder`?
1. Have a git files (`git ls-files`) version of `File Bunny: Open File`. See branch *open-gitfiles*.
1. Add recent items to top of file list for `File Bunny: Open Folder`.
1. Add more tests (refactor).
1. `File Bunny: New Project from Template`
1. `File Bunny: New Project from Template`?
1. Add multi-root workspace support?

## Long-standing API issues
Expand Down

0 comments on commit c986931

Please sign in to comment.