|
4 | 4 | import * as _ from "lodash"; |
5 | 5 | import { |
6 | 6 | commands, Event, EventEmitter, ExtensionContext, extensions, ProviderResult, |
7 | | - Range, Selection, TextEditorRevealType, TreeDataProvider, TreeItem, Uri, window, workspace, |
| 7 | + Range, TreeDataProvider, TreeItem, Uri, window, workspace, |
8 | 8 | } from "vscode"; |
9 | 9 | import { instrumentOperation, instrumentOperationAsVsCodeCommand } from "vscode-extension-telemetry-wrapper"; |
10 | 10 | import { Commands } from "../commands"; |
@@ -42,8 +42,10 @@ export class DependencyDataProvider implements TreeDataProvider<ExplorerNode> { |
42 | 42 | commands.executeCommand("copyFilePath", Uri.parse(node.uri)))); |
43 | 43 | context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.VIEW_PACKAGE_COPY_RELATIVE_FILE_PATH, (node: INodeData) => |
44 | 44 | commands.executeCommand("copyRelativeFilePath", Uri.parse(node.uri)))); |
45 | | - context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.VIEW_PACKAGE_OPEN_FILE, (uri) => this.openFile(uri))); |
46 | | - context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.VIEW_PACKAGE_OUTLINE, (uri, range) => this.goToOutline(uri, range))); |
| 45 | + context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.VIEW_PACKAGE_OPEN_FILE, (uri) => |
| 46 | + commands.executeCommand(Commands.VSCODE_OPEN, Uri.parse(uri)))); |
| 47 | + context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.VIEW_PACKAGE_OUTLINE, (uri, range) => |
| 48 | + window.showTextDocument(Uri.parse(uri), { selection: range }))); |
47 | 49 | context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.JAVA_PROJECT_BUILD_WORKSPACE, () => |
48 | 50 | commands.executeCommand(Commands.JAVA_BUILD_WORKSPACE))); |
49 | 51 | context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.JAVA_PROJECT_CLEAN_WORKSPACE, () => |
@@ -81,20 +83,6 @@ export class DependencyDataProvider implements TreeDataProvider<ExplorerNode> { |
81 | 83 | this._refreshDelayTrigger = _.debounce(this.doRefresh, wait); |
82 | 84 | } |
83 | 85 |
|
84 | | - public openFile(uri: string) { |
85 | | - return workspace.openTextDocument(Uri.parse(uri)).then((res) => { |
86 | | - return window.showTextDocument(res); |
87 | | - }); |
88 | | - } |
89 | | - |
90 | | - public goToOutline(uri: string, range: Range): Thenable<{}> { |
91 | | - return this.openFile(uri).then((editor) => { |
92 | | - editor.revealRange(range, TextEditorRevealType.Default); |
93 | | - editor.selection = new Selection(range.start, range.start); |
94 | | - return commands.executeCommand("workbench.action.focusActiveEditorGroup"); |
95 | | - }); |
96 | | - } |
97 | | - |
98 | 86 | public getTreeItem(element: ExplorerNode): TreeItem | Thenable<TreeItem> { |
99 | 87 | return element.getTreeItem(); |
100 | 88 | } |
|
0 commit comments