@@ -5,11 +5,11 @@ import {
55 commands , Event , EventEmitter , ExtensionContext , ProviderResult , Range ,
66 Selection , TextEditorRevealType , TreeDataProvider , TreeItem , Uri , window , workspace ,
77} from "vscode" ;
8+ import { instrumentOperation } from "vscode-extension-telemetry-wrapper" ;
89import { Commands } from "../commands" ;
910import { Jdtls } from "../java/jdtls" ;
1011import { INodeData , NodeKind } from "../java/nodeData" ;
1112import { Telemetry } from "../telemetry" ;
12- import { DataNode } from "./dataNode" ;
1313import { ExplorerNode } from "./explorerNode" ;
1414import { ProjectNode } from "./projectNode" ;
1515import { WorkspaceNode } from "./workspaceNode" ;
@@ -24,9 +24,12 @@ export class DependencyDataProvider implements TreeDataProvider<ExplorerNode> {
2424 private _rootItems : ExplorerNode [ ] = null ;
2525
2626 constructor ( public readonly context : ExtensionContext ) {
27- context . subscriptions . push ( commands . registerCommand ( Commands . VIEW_PACKAGE_REFRESH , this . refresh , this ) ) ;
28- context . subscriptions . push ( commands . registerCommand ( Commands . VIEW_PACKAGE_OPEN_FILE , this . openFile , this ) ) ;
29- context . subscriptions . push ( commands . registerCommand ( Commands . VIEW_PACKAGE_OUTLINE , this . goToOutline , this ) ) ;
27+ context . subscriptions . push ( commands . registerCommand ( Commands . VIEW_PACKAGE_REFRESH ,
28+ instrumentOperation ( Commands . VIEW_PACKAGE_REFRESH , ( ) => this . refresh ( ) ) ) ) ;
29+ context . subscriptions . push ( commands . registerCommand ( Commands . VIEW_PACKAGE_OPEN_FILE ,
30+ instrumentOperation ( Commands . VIEW_PACKAGE_OPEN_FILE , ( _operationId , uri ) => this . openFile ( uri ) ) ) ) ;
31+ context . subscriptions . push ( commands . registerCommand ( Commands . VIEW_PACKAGE_OUTLINE ,
32+ instrumentOperation ( Commands . VIEW_PACKAGE_OUTLINE , ( _operationId , uri , range ) => this . goToOutline ( uri , range ) ) ) ) ;
3033 }
3134
3235 public refresh ( ) {
@@ -36,14 +39,12 @@ export class DependencyDataProvider implements TreeDataProvider<ExplorerNode> {
3639
3740 public openFile ( uri : string ) {
3841 return workspace . openTextDocument ( Uri . parse ( uri ) ) . then ( ( res ) => {
39- Telemetry . sendEvent ( "open source file" ) ;
4042 return window . showTextDocument ( res ) ;
4143 } ) ;
4244 }
4345
4446 public goToOutline ( uri : string , range : Range ) : Thenable < { } > {
4547 return this . openFile ( uri ) . then ( ( editor ) => {
46- Telemetry . sendEvent ( "view package outline" ) ;
4748 editor . revealRange ( range , TextEditorRevealType . Default ) ;
4849 editor . selection = new Selection ( range . start , range . start ) ;
4950 return commands . executeCommand ( "workbench.action.focusActiveEditorGroup" ) ;
0 commit comments