File tree Expand file tree Collapse file tree 4 files changed +31
-1
lines changed
Expand file tree Collapse file tree 4 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 255255 "command" : " python-envs.reportIssue" ,
256256 "title" : " %python-envs.reportIssue.title%" ,
257257 "category" : " Python Environments"
258+ },
259+ {
260+ "command" : " python-envs.revealProjectInExplorer" ,
261+ "title" : " %python-envs.revealProjectInExplorer.title%" ,
262+ "category" : " Python Envs" ,
263+ "icon" : " $(folder-opened)"
258264 }
259265 ],
260266 "menus" : {
326332 {
327333 "command" : " python-envs.createAny" ,
328334 "when" : " false"
335+ },
336+ {
337+ "command" : " python-envs.revealProjectInExplorer" ,
338+ "when" : " false"
329339 }
330340 ],
331341 "view/item/context" : [
395405 "group" : " inline" ,
396406 "when" : " view == python-projects && viewItem =~ /.*python-workspace.*/"
397407 },
408+ {
409+ "command" : " python-envs.revealProjectInExplorer" ,
410+ "group" : " inline" ,
411+ "when" : " view == python-projects && viewItem =~ /.*python-workspace.*/"
412+ },
398413 {
399414 "command" : " python-envs.uninstallPackage" ,
400415 "group" : " inline" ,
Original file line number Diff line number Diff line change 3434 "python-envs.createNewProjectFromTemplate.title" : " Create New Project from Template" ,
3535 "python-envs.terminal.activate.title" : " Activate Environment in Current Terminal" ,
3636 "python-envs.terminal.deactivate.title" : " Deactivate Environment in Current Terminal" ,
37- "python-envs.uninstallPackage.title" : " Uninstall Package"
37+ "python-envs.uninstallPackage.title" : " Uninstall Package" ,
38+ "python-envs.revealProjectInExplorer.title" : " Reveal Project in Explorer"
3839}
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ import {
3232 refreshPackagesCommand ,
3333 removeEnvironmentCommand ,
3434 removePythonProject ,
35+ revealProjectInExplorer ,
3536 runAsTaskCommand ,
3637 runInDedicatedTerminalCommand ,
3738 runInTerminalCommand ,
@@ -356,6 +357,9 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
356357 commands . registerCommand ( 'python-envs.copyProjectPath' , async ( item ) => {
357358 await copyPathToClipboard ( item ) ;
358359 } ) ,
360+ commands . registerCommand ( 'python-envs.revealProjectInExplorer' , async ( item ) => {
361+ await revealProjectInExplorer ( item ) ;
362+ } ) ,
359363 commands . registerCommand ( 'python-envs.terminal.activate' , async ( ) => {
360364 const terminal = activeTerminal ( ) ;
361365 if ( terminal ) {
Original file line number Diff line number Diff line change @@ -649,3 +649,13 @@ export async function copyPathToClipboard(item: unknown): Promise<void> {
649649 traceVerbose ( `Invalid context for copy path to clipboard: ${ item } ` ) ;
650650 }
651651}
652+
653+ export async function revealProjectInExplorer ( item : unknown ) : Promise < void > {
654+ if ( item instanceof ProjectItem ) {
655+ const projectUri = item . project . uri ;
656+ await commands . executeCommand ( 'revealFileInOS' , projectUri ) ;
657+ traceInfo ( `Revealed project in explorer: ${ projectUri . fsPath } ` ) ;
658+ } else {
659+ traceVerbose ( `Invalid context for reveal project in explorer: ${ item } ` ) ;
660+ }
661+ }
You can’t perform that action at this time.
0 commit comments