Skip to content

Commit 3ce6f76

Browse files
Add option to reveal selected path in VS Code Explorer
1 parent cdd189c commit 3ce6f76

File tree

2 files changed

+110
-3
lines changed

2 files changed

+110
-3
lines changed

package-lock.json

Lines changed: 96 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33
import { commands } from "vscode";
4+
import * as vscode from 'vscode';
5+
46
/**
57
* Commonly used commands
68
*/
@@ -30,8 +32,6 @@ export namespace Commands {
3032

3133
export const VIEW_PACKAGE_OUTLINE = "java.view.package.outline";
3234

33-
export const VIEW_PACKAGE_REVEAL_FILE_OS = "java.view.package.revealFileInOS";
34-
3535
export const VIEW_PACKAGE_COPY_FILE_PATH = "java.view.package.copyFilePath";
3636

3737
export const VIEW_PACKAGE_COPY_RELATIVE_FILE_PATH = "java.view.package.copyRelativeFilePath";
@@ -67,6 +67,8 @@ export namespace Commands {
6767
export const VIEW_PACKAGE_DELETE_FILE_PERMANENTLY = "java.view.package.deleteFilePermanently";
6868

6969
export const VIEW_PACKAGE_REVEAL_IN_PROJECT_EXPLORER = "java.view.package.revealInProjectExplorer";
70+
71+
export const VIEW_PACKAGE_REVEAL_FILE_VSCODE = 'java.view.package.revealFileInVSCode';
7072

7173
export const VIEW_PACKAGE_NEW_FILE = "java.view.package.newFile";
7274

@@ -185,5 +187,14 @@ export function executeJavaLanguageServerCommand(...rest: any[]) {
185187

186188
export async function executeJavaExtensionCommand(commandName: string, ...rest: any[]) {
187189
// TODO: need to handle error and trace telemetry
188-
return commands.executeCommand(commandName, ...rest);
190+
return commands.executeCommand(commandName, ...rest);
189191
}
192+
193+
194+
195+
vscode.commands.registerCommand('java.view.package.revealFileInVSCode', (uri: vscode.Uri) => {
196+
if (uri) {
197+
vscode.commands.executeCommand('workbench.view.explorer');
198+
vscode.commands.executeCommand('revealInExplorer', uri);
199+
}
200+
});

0 commit comments

Comments
 (0)