@@ -5,6 +5,7 @@ import * as os from "os";
55import * as path from "path" ;
66import * as vscode from "vscode" ;
77
8+ import { instrumentOperation } from "vscode-extension-telemetry-wrapper" ;
89import * as anchor from "./anchor" ;
910import * as commands from "./commands" ;
1011import { logger , Type } from "./logger" ;
@@ -30,20 +31,26 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
3031 // Returns an initial debug configurations based on contextual information.
3132 public provideDebugConfigurations ( folder : vscode . WorkspaceFolder | undefined , token ?: vscode . CancellationToken ) :
3233 vscode . ProviderResult < vscode . DebugConfiguration [ ] > {
33- return < Thenable < vscode . DebugConfiguration [ ] > > this . provideDebugConfigurationsAsync ( folder ) ;
34+ const provideDebugConfigurationsHandler = instrumentOperation ( "provideDebugConfigurations" , ( operationId : string ) => {
35+ return < Thenable < vscode . DebugConfiguration [ ] > > this . provideDebugConfigurationsAsync ( folder ) ;
36+ } ) ;
37+ return provideDebugConfigurationsHandler ( ) ;
3438 }
3539
3640 // Try to add all missing attributes to the debug configuration being launched.
3741 public resolveDebugConfiguration ( folder : vscode . WorkspaceFolder | undefined , config : vscode . DebugConfiguration , token ?: vscode . CancellationToken ) :
3842 vscode . ProviderResult < vscode . DebugConfiguration > {
39- this . resolveVariables ( folder , config ) ;
40- return this . heuristicallyResolveDebugConfiguration ( folder , config ) ;
43+ const resolveDebugConfigurationHandler = instrumentOperation ( "resolveDebugConfiguration" , ( operationId : string ) => {
44+ this . resolveVariables ( folder , config ) ;
45+ return this . heuristicallyResolveDebugConfiguration ( folder , config ) ;
46+ } ) ;
47+ return resolveDebugConfigurationHandler ( ) ;
4148 }
4249
4350 private provideDebugConfigurationsAsync ( folder : vscode . WorkspaceFolder | undefined , token ?: vscode . CancellationToken ) {
44- return vscode . window . withProgress ( { location : vscode . ProgressLocation . Window } , ( p ) => {
51+ return vscode . window . withProgress ( { location : vscode . ProgressLocation . Window } , ( p ) => {
4552 return new Promise ( ( resolve , reject ) => {
46- p . report ( { message : "Auto generating configuration..." } ) ;
53+ p . report ( { message : "Auto generating configuration..." } ) ;
4754 resolveMainClass ( folder ? folder . uri : undefined ) . then ( ( res : IMainClassOption [ ] ) => {
4855 let cache ;
4956 cache = { } ;
@@ -75,7 +82,7 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
7582 } ;
7683 resolve ( [ defaultLaunchConfig , ...launchConfigs , defaultAttachConfig ] ) ;
7784 } , ( ex ) => {
78- p . report ( { message : `failed to generate configuration. ${ ex } ` } ) ;
85+ p . report ( { message : `failed to generate configuration. ${ ex } ` } ) ;
7986 reject ( ex ) ;
8087 } ) ;
8188 } ) ;
@@ -84,8 +91,8 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
8491
8592 private resolveVariables ( folder : vscode . WorkspaceFolder , config : vscode . DebugConfiguration ) : void {
8693 // all the properties whose values are string or array of string
87- const keys = [ "mainClass" , "args" , "vmArgs" , "modulePaths" , "classPaths" , "projectName" ,
88- "env" , "sourcePaths" , "encoding" , "cwd" , "hostName" ] ;
94+ const keys = [ "mainClass" , "args" , "vmArgs" , "modulePaths" , "classPaths" , "projectName" ,
95+ "env" , "sourcePaths" , "encoding" , "cwd" , "hostName" ] ;
8996 if ( ! config ) {
9097 return ;
9198 }
@@ -225,7 +232,7 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
225232 * Converts an array of arguments to a string as the args and vmArgs.
226233 */
227234 private concatArgs ( args : any [ ] ) : string {
228- return _ . join ( _ . map ( args , ( arg : any ) : string => {
235+ return _ . join ( _ . map ( args , ( arg : any ) : string => {
229236 const str = String ( arg ) ;
230237 // if it has quotes or spaces, use double quotes to wrap it
231238 if ( / [ ' " \s ] / . test ( str ) ) {
@@ -440,7 +447,7 @@ function resolveMainClass(workspaceUri: vscode.Uri): Promise<IMainClassOption[]>
440447
441448function validateLaunchConfig ( workspaceUri : vscode . Uri , mainClass : string , projectName : string , containsExternalClasspaths : boolean ) :
442449 Promise < ILaunchValidationResponse > {
443- return < Promise < ILaunchValidationResponse > > commands . executeJavaLanguageServerCommand ( commands . JAVA_VALIDATE_LAUNCHCONFIG ,
450+ return < Promise < ILaunchValidationResponse > > commands . executeJavaLanguageServerCommand ( commands . JAVA_VALIDATE_LAUNCHCONFIG ,
444451 workspaceUri ? workspaceUri . toString ( ) : undefined , mainClass , projectName , containsExternalClasspaths ) ;
445452}
446453
0 commit comments