mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
adding open for script
This commit is contained in:
parent
2ce1f53e36
commit
2b73118942
|
@ -75,17 +75,22 @@
|
||||||
{
|
{
|
||||||
"command": "npm.openScript",
|
"command": "npm.openScript",
|
||||||
"when": "view == npm && viewItem == packageJSON",
|
"when": "view == npm && viewItem == packageJSON",
|
||||||
"group": "1_navigation"
|
"group": "navigation"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "npm.runScript",
|
"command": "npm.runScript",
|
||||||
"when": "view == npm && viewItem == script",
|
"when": "view == npm && viewItem == script",
|
||||||
"group": "1_navigation"
|
"group": "navigation@1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "npm.debugScript",
|
"command": "npm.debugScript",
|
||||||
"when": "view == npm && viewItem == script",
|
"when": "view == npm && viewItem == script",
|
||||||
"group": "1_navigation"
|
"group": "navigation@2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "npm.openScript",
|
||||||
|
"when": "view == npm && viewItem == script",
|
||||||
|
"group": "navigation@3"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -162,8 +162,17 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async openScript(packageJSON: PackageJSON) {
|
private async openScript(selection: PackageJSON | NpmScript) {
|
||||||
let document: TextDocument = await workspace.openTextDocument(packageJSON.resourceUri!);
|
let uri: Uri | undefined = undefined;
|
||||||
|
if (selection instanceof PackageJSON) {
|
||||||
|
uri = selection.resourceUri!;
|
||||||
|
} else if (selection instanceof NpmScript) {
|
||||||
|
uri = selection.package.resourceUri;
|
||||||
|
}
|
||||||
|
if (!uri) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let document: TextDocument = await workspace.openTextDocument(uri);
|
||||||
window.showTextDocument(document);
|
window.showTextDocument(document);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue