This commit is contained in:
Jonathan Carter 2021-02-10 04:19:14 +00:00 коммит произвёл GitHub
Родитель 5bd97550ca
Коммит 1c2dfa1aed
6 изменённых файлов: 40 добавлений и 14 удалений

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

@ -1,3 +1,9 @@
## v0.0.44 (02/09/2021)
- Added the `codetour.promptForWorkspaceTours` setting to allow users to supress the notification when opening workspaces with tours
- Fixed a bug with replaying directory and content steps
- Fixed a bug where there was a "flash" after adding the first step to a new tour
## v0.0.43 (02/02/2021)
- Tour steps can now be associated with a regular expression or "comment marker" (e.g. `// CT1.1`) in addition to a line number.

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

@ -75,7 +75,7 @@ At any time, you can right-click a tour in the `CodeTour` tree and change it's t
### Linking Tours
If you want to create a series of tours, that a user can navigate through in sequence, then simply prefix your tour title's with the number they represent in the tour order (e.g. `1: Foo`, `2 - Bar`). When your tours are titled like this, the tour player will automatically provides the following benefis to your readers:
If you want to create a series of tours, that a user can navigate through in sequence, then simply prefix your tour title's with the number they represent in the tour order (e.g. `1: Foo`, `2 - Bar`). When your tours are titled like this, the tour player will automatically provide the following benefis to your readers:
1. If the current tour has a subsequent tour, then it's final step will display a `Next Tour` link instead of the `Finish Tour` link. This allows users to easily jump to the next tour.
@ -194,16 +194,17 @@ Within the `.tours` (or `.vscode/tours`) directory, you can organize your tour f
- `description` - An optional description for the tour, which will be shown as the tooltip for the tour in the `CodeTour` tree view
- `ref` - An optional "git ref" (branch/tag/commit) that this tour applies to. See [versioning tours](#versioning-tours) for more details.
- `isPrimary` - Indicates that this tour is the primary tour within the workspace that an end-user should be guided through.
- `nextTour` - The title of the tour that this tour is [meant to precede](#linking-tours).
- `steps` _(Required)_ - An array of tour steps
- `description` _(Required)_ - The text which explains the current file/line number, and can include plain text and markdown syntax
- `file` - The file path (relative to the workspace root) that this step is associated with
- `directory` - The path of a directory (relative to the workspace root) that this step is associated with. _Note: This property takes precedence over the `file` property, and so will "win" if both are present._
- `view` - The ID of a VS Code view that will be automatically focused when this step is navigated to.
- `uri` - An absolute URI that this step is associated with. Note that `uri` and `file` are mutually exclusive, so only set one per step
- `line` - The 1-based line number that this step is associated with
- `pattern` - A regular expression to associate the step with. This is only considered when the line property isn't set, and allows you to associate steps with line content as opposed to ordinal.
- `title` - An optional title, which will be displayed as the step name in the `CodeTour` tree view.
- `commands` - An array of VS Code command strings, that indicate the name of a command (e.g. `codetour.endTour`) and any optional parameters to pass to it, specified as a query string array (eg. `codetour.endTour?[2]`).
- `nextTour` - The title of the tour that this tour is [linked to](#linking-tours).
- `view` - The ID of a VS Code view that will be automatically focused when this step is navigated to.
For an example, refer to the `.tours/tree.tour` file of this repository.
@ -345,6 +346,7 @@ In addition to the `CodeTour` tree view and the status bar item, the CodeTour ex
The `CodeTour` extension contributes the following settings:
- `codetour.promptForWorkspaceTours` - Specifies whether or not to display a notification when opening a workspace with tours for the first time.
- `codetour.showMarkers` - Specifies whether or not to show [tour markers](#tour-markers). Defaults to `true`.
### Keybindings

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

@ -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.43",
"version": "0.0.44",
"author": {
"name": "Microsoft Corporation"
},
@ -41,6 +41,11 @@
"type": "object",
"title": "CodeTour",
"properties": {
"codetour.promptForWorkspaceTours": {
"type": "boolean",
"default": true,
"description": "Specifies whether or not to display a notification when opening a workspace with tours for the first time."
},
"codetour.showMarkers": {
"type": "boolean",
"default": true,

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

@ -226,17 +226,17 @@ async function renderCurrentStep() {
const match = document.getText().match(new RegExp(stepPattern));
if (match) {
line = document.positionAt(match.index!).line;
} else {
line = 2000;
}
} else {
// The step doesn't have a discoverable line number and so
// stick the step at the end of the file. Unfortunately, there
// isn't a way to say EOF, so 2000 is a temporary hack.
line = 2000;
}
}
if (!line) {
// The step doesn't have a discoverable line number and so
// stick the step at the end of the file. Unfortunately, there
// isn't a way to say EOF, so 2000 is a temporary hack.
line = 2000;
}
const range = new Range(line!, 0, line!, 0);
let label = `Step #${currentStep + 1} of ${currentTour!.steps.length}`;

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

@ -75,7 +75,12 @@ export function registerRecorderCommands() {
? title
: path.basename(title.path).replace(".tour", "");
const tour = { title: tourTitle, steps: [] };
const tour = {
$schema: "https://aka.ms/codetour-schema",
title: tourTitle,
steps: []
};
if (ref && ref !== "HEAD") {
(tour as any).ref = ref;
}

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

@ -1,7 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { commands, EventEmitter, Memento, Uri, window } from "vscode";
import {
commands,
EventEmitter,
Memento,
Uri,
window,
workspace
} from "vscode";
import { CodeTour, store } from ".";
import { EXTENSION_NAME, FS_SCHEME, FS_SCHEME_CONTENT } from "../constants";
import { startPlayer, stopPlayer } from "../player";
@ -139,7 +146,8 @@ export async function promptForTour(
if (
tours.length > 0 &&
!globalState.get(key) &&
!isLiveShareWorkspace(workspaceRoot)
!isLiveShareWorkspace(workspaceRoot) &&
workspace.getConfiguration("codetour").get("promptForWorkspaceTours", true)
) {
globalState.update(key, true);