This commit is contained in:
Jonathan Carter 2020-05-18 00:04:47 -07:00
Родитель 29ce3ea5c1
Коммит f628413cab
10 изменённых файлов: 92 добавлений и 21 удалений

Просмотреть файл

@ -1,4 +0,0 @@
{
"title": "foo",
"steps": []
}

Просмотреть файл

@ -33,4 +33,4 @@
"description": "### Updating\nWhen a tour is activate and/or navigated, we update the status bar item to indicate the current step and title."
}
]
}
}

Просмотреть файл

@ -1,5 +1,6 @@
## v0.0.26 (05/15/2020)
## v0.0.26 (05/17/2020)
- Added support for a codebase to have a "primary" tour, which provides a little more prescription to folks that are onboarding
- Added the `Change Title` command to step nodes in the `CodeTour` tree. This allows you to easily give steps a title without needing to add a markdown header to their description
- Added support for multi-select deletes in the `CodeTour` tree, for both tour and step nodes
- Added a `Preview Tour` command that allows putting the active tour into preview mode

Просмотреть файл

@ -146,6 +146,12 @@ If you want to edit an existing tour, simply right-click the tour in the `CodeTo
At any time, you can right-click a tour in the `CodeTour` tree and change it's title, description or git ref, by selecting the `Change Title`, `Change Description` or `Change Git Ref` menu items. Additionally, you can delete a tour by right-clicking it in the `CodeTour` tree and seelcting `Delete Tour`.
### Primary Tours
A codebase can include one or more tours, but it might have a primary tour, that is intended for new developers to start with. This way, when they open the codebase for the first time, they can be immediately presented with this tour, as opposed to a list of all tours.
In order to mark a specific tour as the primary tour, simply right-click it in the `CodeTour` tree, and select `Make Primary`. When you mark a tour as primary, any other tours that were marked as primary, will be updated to remove that annotation. Additionally, if you want to manually unmark a tour as being the primary tour, you can right-click it and select `Unmake Primary`.
### Shell Commands
In order to add more interactivity to a tour, you can embed shell commands into a step (e.g. to perform a build, run tests, start an app), using the special `>>` synax, followed by the shell command you want to run (e.g. `>> npm run compile`). This will be converted into a hyperlink, that when clicked, will launch a new integrated terminal (called `CodeTour`) and will run the specified command.

Просмотреть файл

@ -3,7 +3,7 @@
"displayName": "CodeTour",
"description": "VS Code extension that allows you to record and playback guided tours of codebases, directly within the editor",
"publisher": "vsls-contrib",
"version": "0.0.25",
"version": "0.0.26",
"repository": {
"type": "git",
"url": "https://github.com/vsls-contrib/codetour"
@ -108,6 +108,10 @@
"category": "CodeTour",
"icon": "$(eye-closed)"
},
{
"command": "codetour.makeTourPrimary",
"title": "Make Primary"
},
{
"command": "codetour.moveTourStepForward",
"title": "Move Down",
@ -177,6 +181,10 @@
"category": "CodeTour",
"icon": "$(debug-start)"
},
{
"command": "codetour.unmakeTourPrimary",
"title": "Unmake Primary"
},
{
"command": "codetour.viewNotebook",
"title": "View Notebook",
@ -261,6 +269,10 @@
"command": "codetour.exportTour",
"when": "false"
},
{
"command": "codetour.makeTourPrimary",
"when": "false"
},
{
"command": "codetour.nextTourStep",
"when": "false"
@ -277,6 +289,10 @@
"command": "codetour.saveTourStep",
"when": "false"
},
{
"command": "codetour.unmakeTourPrimary",
"when": "false"
},
{
"command": "codetour.viewNotebook",
"when": "false"
@ -365,62 +381,72 @@
"view/item/context": [
{
"command": "codetour.endTour",
"when": "viewItem =~ /codetour.tour(.recording)?.active/",
"when": "viewItem =~ /^codetour.tour(.recording)?.active/",
"group": "inline@1"
},
{
"command": "codetour.startTour",
"when": "viewItem == codetour.tour",
"group": "inline@2"
"when": "viewItem =~ /^codetour.tour(.primary)?$/",
"group": "inline@1"
},
{
"command": "codetour.resumeTour",
"when": "viewItem =~ /codetour.tour(.recording)?.active$/",
"when": "viewItem =~ /^codetour.tour(.primary)?(.recording)?.active$/",
"group": "active@1"
},
{
"command": "codetour.endTour",
"when": "viewItem =~ /codetour.tour(.recording)?.active$/",
"when": "viewItem =~ /^codetour.tour(.primary)?(.recording)?.active$/",
"group": "active@2"
},
{
"command": "codetour.startTour",
"when": "viewItem == codetour.tour",
"when": "viewItem =~ /^codetour.tour(.primary)?$/",
"group": "basic@1"
},
{
"command": "codetour.changeTourTitle",
"command": "codetour.makeTourPrimary",
"when": "viewItem =~ /^codetour.tour(.recording)?(.active)?$/",
"group": "basic@2"
},
{
"command": "codetour.unmakeTourPrimary",
"when": "viewItem =~ /^codetour.tour.primary(.recording)?(.active)?$/",
"group": "basic@3"
},
{
"command": "codetour.changeTourTitle",
"when": "viewItem =~ /^codetour.tour(.primary)?(.recording)?(.active)?$/",
"group": "change@1"
},
{
"command": "codetour.changeTourDescription",
"when": "viewItem =~ /^codetour.tour(.recording)?(.active)?$/",
"when": "viewItem =~ /^codetour.tour(.primary)?(.recording)?(.active)?$/",
"group": "change@2"
},
{
"command": "codetour.changeTourRef",
"when": "viewItem =~ /^codetour.tour(.recording)?(.active)?$/ && gitOpenRepositoryCount != 0",
"when": "viewItem =~ /^codetour.tour(.primary)?(.recording)?(.active)?$/ && gitOpenRepositoryCount != 0",
"group": "change@3"
},
{
"command": "codetour.editTour",
"when": "viewItem =~ /^codetour.tour(.active)?$/",
"when": "viewItem =~ /^codetour.tour(.primary)?(.active)?$/",
"group": "edit@1"
},
{
"command": "codetour.previewTour",
"when": "viewItem =~ /^codetour.tour(.recording)/",
"when": "viewItem =~ /^codetour.tour(.primary)?.recording/",
"group": "edit@1"
},
{
"command": "codetour.deleteTour",
"when": "viewItem =~ /^codetour.tour(.recording)?(.active)?$/",
"when": "viewItem =~ /^codetour.tour(.primary)?(.recording)?(.active)?$/",
"group": "edit@2"
},
{
"command": "codetour.exportTour",
"when": "viewItem =~ /^codetour.tour(.active)?$/",
"when": "viewItem =~ /^codetour.tour(.primary)?(.active)?$/",
"group": "export@1"
},
{

Просмотреть файл

@ -16,6 +16,10 @@
"type": "string",
"description": "Indicates the git ref (branch/commit/tag) that this tour associate with."
},
"isPrimary": {
"type": "boolean",
"description": "Specifies whether the tour represents the primary tour for this codebase."
},
"steps": {
"type": "array",
"description": "Specifies the list of steps that are included in the code tour.",

Просмотреть файл

@ -327,6 +327,31 @@ export function registerRecorderCommands() {
}
);
vscode.commands.registerCommand(
`${EXTENSION_NAME}.makeTourPrimary`,
async (node: CodeTourNode) => {
const primaryTour = node.tour;
primaryTour.isPrimary = true;
saveTour(primaryTour);
store.tours
.filter(tour => tour.id !== primaryTour.id && tour.isPrimary)
.forEach(tour => {
delete tour.isPrimary;
saveTour(tour);
});
}
);
vscode.commands.registerCommand(
`${EXTENSION_NAME}.unmakeTourPrimary`,
async (node: CodeTourNode) => {
const primaryTour = node.tour;
delete primaryTour.isPrimary;
saveTour(primaryTour);
}
);
vscode.commands.registerCommand(
`${EXTENSION_NAME}.saveTourStep`,
async (comment: CodeTourComment) => {

Просмотреть файл

@ -78,7 +78,13 @@ export async function promptForTour(globalState: Memento) {
"Start CodeTour"
)
) {
commands.executeCommand(`${EXTENSION_NAME}.startTour`);
const primaryTour = store.tours.find(tour => tour.isPrimary);
if (primaryTour) {
startCodeTour(primaryTour);
} else {
commands.executeCommand(`${EXTENSION_NAME}.startTour`);
}
}
}
}

Просмотреть файл

@ -23,6 +23,7 @@ export interface CodeTour {
description?: string;
steps: CodeTourStep[];
ref?: string;
isPrimary?: boolean;
}
export interface ActiveTour {

Просмотреть файл

@ -26,6 +26,12 @@ export class CodeTourNode extends TreeItem {
const contextValues = ["codetour.tour"];
if (tour.isPrimary) {
contextValues.push("primary");
this.description += " (Primary)";
}
if (isRecording(tour)) {
contextValues.push("recording");
}