Updating sample tours
This commit is contained in:
Родитель
5a0a572d2b
Коммит
5b20a9b47f
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"title": "Debugging a CodeTour",
|
||||
"steps": [
|
||||
{
|
||||
"file": "src/store/provider.ts",
|
||||
"line": 0,
|
||||
"description": "Hi **there** you"
|
||||
},
|
||||
{
|
||||
"file": "src/store/provider.ts",
|
||||
"line": 12,
|
||||
"description": "Hi there agaib"
|
||||
},
|
||||
{
|
||||
"file": "src/extension.ts",
|
||||
"line": 23,
|
||||
"description": "Hi there #3"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"title": "Another tour...",
|
||||
"steps": [
|
||||
{
|
||||
"file": "src/store/provider.ts",
|
||||
"line": 0,
|
||||
"description": "Hi **there** you"
|
||||
},
|
||||
{
|
||||
"file": "src/store/provider.ts",
|
||||
"line": 12,
|
||||
"description": "Hi there agaib"
|
||||
},
|
||||
{
|
||||
"file": "src/extension.ts",
|
||||
"line": 23,
|
||||
"description": "Hi there #3"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"title": "YAT",
|
||||
"steps": [
|
||||
{
|
||||
"file": "src/store/provider.ts",
|
||||
"line": 0,
|
||||
"description": "Hi **there** you"
|
||||
},
|
||||
{
|
||||
"file": "src/store/provider.ts",
|
||||
"line": 12,
|
||||
"description": "Hi there agaib"
|
||||
},
|
||||
{
|
||||
"file": "src/extension.ts",
|
||||
"line": 23,
|
||||
"description": "Hi there #3"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -42,10 +42,11 @@ In addition to your repo's "main tour", you can also create one or more "sub-tou
|
|||
Within the tour file, you need to specify the following required properties:
|
||||
|
||||
- `title` - The display name of the tour, which will be shown in the `Code Tours` tree view, quick pick, etc.
|
||||
- `description` - An optional description for the tour
|
||||
- `steps` - An array of tour steps
|
||||
- `file` - The file path (relative to the workspace root) that this step is associated with
|
||||
- `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 line number that this step is associated with
|
||||
- `line` - The 1-based line number that this step is associated with
|
||||
- `description` - The text which explains the current file/line number, and can include plain text and markdown syntax
|
||||
|
||||
For an example, refer to the `.vscode/tour.json` file of this repository.
|
||||
|
|
|
@ -45,6 +45,11 @@
|
|||
"title": "Previous",
|
||||
"icon": "$(arrow-left)"
|
||||
},
|
||||
{
|
||||
"command": "codetour.refreshTours",
|
||||
"title": "Refresh Tours",
|
||||
"category": "Code Tour"
|
||||
},
|
||||
{
|
||||
"command": "codetour.resumeTour",
|
||||
"title": "Resume Current Tour",
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
"type": "string",
|
||||
"description": "Specifies the title of the code tour."
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Specifies an optional description for the code tour."
|
||||
},
|
||||
"steps": {
|
||||
"type": "array",
|
||||
"description": "Specifies the list of steps that are included in the code tour.",
|
||||
|
|
|
@ -8,6 +8,7 @@ import {
|
|||
startCodeTour,
|
||||
resumeCurrentCodeTour
|
||||
} from "./store/actions";
|
||||
import { discoverTours } from "./store/provider";
|
||||
|
||||
interface CodeTourQuickPickItem extends vscode.QuickPickItem {
|
||||
tour: CodeTour;
|
||||
|
@ -66,6 +67,16 @@ export function registerCommands() {
|
|||
moveCurrentCodeTourForward
|
||||
);
|
||||
|
||||
vscode.commands.registerCommand(
|
||||
`${EXTENSION_NAME}.refreshTours`,
|
||||
async () => {
|
||||
if (vscode.workspace.workspaceFolders) {
|
||||
const workspaceRoot = vscode.workspace.workspaceFolders[0].uri.toString();
|
||||
await discoverTours(workspaceRoot);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
vscode.commands.registerCommand(
|
||||
`${EXTENSION_NAME}.resumeTour`,
|
||||
resumeCurrentCodeTour
|
||||
|
|
|
@ -65,7 +65,11 @@ async function renderStep() {
|
|||
const currentStep = store.currentStep;
|
||||
|
||||
const step = currentTour!.steps[currentStep];
|
||||
const range = new Range(step.line, 0, step.line, 0);
|
||||
|
||||
// Adjust the line number, to allow the user to specify
|
||||
// them in 1-based format, not 0-based
|
||||
const line = step.line - 1;
|
||||
const range = new Range(line, 0, line, 0);
|
||||
let label = `Step #${currentStep + 1} of ${currentTour!.steps.length}`;
|
||||
|
||||
if (currentTour.title) {
|
||||
|
|
|
@ -19,7 +19,7 @@ class CodeTourTreeProvider implements TreeDataProvider<TreeItem>, Disposable {
|
|||
|
||||
constructor(private extensionPath: string) {
|
||||
reaction(
|
||||
() => [store.hasTours],
|
||||
() => [store.hasTours, store.mainTour, store.subTours],
|
||||
() => {
|
||||
this._onDidChangeTreeData.fire();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче