Adding more tree commands
This commit is contained in:
Родитель
b6f070f922
Коммит
e3745a527d
|
@ -1,7 +1,7 @@
|
|||
## v0.0.6 (03/13/2020)
|
||||
|
||||
- Added the `Code Tour: End Tour` command to the command palette
|
||||
- Added the `Change Title`, `Change Description` and `Delete Tour` commands to the `Code Tours` tree view to enable easily managing existing tours
|
||||
- Added the `'Resume Tour`, `End Tour`, `Change Title`, `Change Description` and `Delete Tour` commands to the `Code Tours` tree view to enable easily managing existing tours
|
||||
|
||||
## v0.0.5 (03/09/2020)
|
||||
|
||||
|
|
35
package.json
35
package.json
|
@ -88,7 +88,7 @@
|
|||
},
|
||||
{
|
||||
"command": "codetour.resumeTour",
|
||||
"title": "Resume Current Tour",
|
||||
"title": "Resume Tour",
|
||||
"category": "Code Tour"
|
||||
},
|
||||
{
|
||||
|
@ -236,18 +236,43 @@
|
|||
"group": "inline@3"
|
||||
},
|
||||
{
|
||||
"command": "codetour.changeTourTitle",
|
||||
"command": "codetour.saveTour",
|
||||
"when": "viewItem =~ /codetour.tour.recording/",
|
||||
"group": "active@1"
|
||||
},
|
||||
{
|
||||
"command": "codetour.resumeTour",
|
||||
"when": "viewItem =~ /codetour.tour(.recording)?.active/",
|
||||
"group": "active@2"
|
||||
},
|
||||
{
|
||||
"command": "codetour.endTour",
|
||||
"when": "viewItem =~ /codetour.tour(.recording)?.active/",
|
||||
"group": "active@3"
|
||||
},
|
||||
{
|
||||
"command": "codetour.startTour",
|
||||
"when": "viewItem == codetour.tour",
|
||||
"group": "basic@1"
|
||||
},
|
||||
{
|
||||
"command": "codetour.changeTourTitle",
|
||||
"when": "viewItem =~ /^codetour.tour/",
|
||||
"group": "change@1"
|
||||
},
|
||||
{
|
||||
"command": "codetour.changeTourDescription",
|
||||
"when": "viewItem == codetour.tour",
|
||||
"group": "basic@2"
|
||||
"when": "viewItem =~ /^codetour.tour/",
|
||||
"group": "change@2"
|
||||
},
|
||||
{
|
||||
"command": "codetour.deleteTour",
|
||||
"when": "viewItem == codetour.tour",
|
||||
"when": "viewItem =~ /^codetour.tour/",
|
||||
"group": "delete@1"
|
||||
},
|
||||
{
|
||||
"command": "codetour.deleteTourStep",
|
||||
"when": "viewItem == codetour.tour.step",
|
||||
"group": "manage@1"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -205,10 +205,14 @@ export function registerCommands() {
|
|||
// @ts-ignore
|
||||
tour[property] = propertyValue;
|
||||
|
||||
const uri = vscode.Uri.parse(tour.id);
|
||||
delete tour.id;
|
||||
const tourContent = JSON.stringify(tour, null, 2);
|
||||
vscode.workspace.fs.writeFile(uri, new Buffer(tourContent));
|
||||
// We don't need to persist the tour change
|
||||
// if it doesn't have an id (e.g. is pending being saved)
|
||||
if (tour.id) {
|
||||
const uri = vscode.Uri.parse(tour.id);
|
||||
delete tour.id;
|
||||
const tourContent = JSON.stringify(tour, null, 2);
|
||||
vscode.workspace.fs.writeFile(uri, new Buffer(tourContent));
|
||||
}
|
||||
}
|
||||
|
||||
vscode.commands.registerCommand(
|
||||
|
@ -224,8 +228,14 @@ export function registerCommands() {
|
|||
vscode.commands.registerCommand(
|
||||
`${EXTENSION_NAME}.deleteTour`,
|
||||
async (node: CodeTourNode) => {
|
||||
const uri = vscode.Uri.parse(node.tour.id);
|
||||
vscode.workspace.fs.delete(uri);
|
||||
if (store.currentTour && node.tour.title === store.currentTour.title) {
|
||||
await endCurrentCodeTour();
|
||||
}
|
||||
|
||||
if (node.tour.id) {
|
||||
const uri = vscode.Uri.parse(node.tour.id);
|
||||
vscode.workspace.fs.delete(uri);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -25,7 +25,11 @@ class CodeTourTreeProvider implements TreeDataProvider<TreeItem>, Disposable {
|
|||
store.subTours,
|
||||
store.isRecording,
|
||||
store.currentTour
|
||||
? store.currentTour.steps.map(step => step.description)
|
||||
? [
|
||||
store.currentTour.title,
|
||||
store.currentTour.description,
|
||||
store.currentTour.steps.map(step => step.description)
|
||||
]
|
||||
: null
|
||||
],
|
||||
() => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче