55
66import { createScanner , parse , SyntaxKind } from 'jsonc-parser' ;
77import { CancellationToken , DebugConfiguration , Position , Range , TextDocument , WorkspaceEdit } from 'vscode' ;
8- import { ICommandManager } from '../../../../common/application/types' ;
98import { noop } from '../../../../common/utils/misc' ;
9+ import { executeCommand } from '../../../../common/vscodeApis/commandApis' ;
10+ import { getActiveTextEditor } from '../../../../common/vscodeApis/windowApis' ;
11+ import { applyEdit , getWorkspaceFolder } from '../../../../common/vscodeApis/workspaceApis' ;
1012import { captureTelemetry } from '../../../../telemetry' ;
1113import { EventName } from '../../../../telemetry/constants' ;
1214import { IDebugConfigurationService } from '../../types' ;
13- import { applyEdit , getActiveTextEditor } from '../utils/common' ;
14- import { getWorkspaceFolder } from '../utils/workspaceFolder' ;
1515
1616type PositionOfCursor = 'InsideEmptyArray' | 'BeforeItem' | 'AfterItem' ;
1717type PositionOfComma = 'BeforeCursor' ;
1818
1919export class LaunchJsonUpdaterServiceHelper {
20- constructor (
21- private readonly commandManager : ICommandManager ,
22- private readonly configurationProvider : IDebugConfigurationService ,
23- ) { }
20+ constructor ( private readonly configurationProvider : IDebugConfigurationService ) { }
2421
2522 @captureTelemetry ( EventName . DEBUGGER_CONFIGURATION_PROMPTS_IN_LAUNCH_JSON )
2623 public async selectAndInsertDebugConfig (
@@ -35,7 +32,7 @@ export class LaunchJsonUpdaterServiceHelper {
3532
3633 if ( ! token . isCancellationRequested && Array . isArray ( configs ) && configs . length > 0 ) {
3734 // Always use the first available debug configuration.
38- await this . insertDebugConfiguration ( document , position , configs [ 0 ] ) ;
35+ await LaunchJsonUpdaterServiceHelper . insertDebugConfiguration ( document , position , configs [ 0 ] ) ;
3936 }
4037 }
4138 }
@@ -49,7 +46,7 @@ export class LaunchJsonUpdaterServiceHelper {
4946 * @returns {Promise<void> }
5047 * @memberof LaunchJsonCompletionItemProvider
5148 */
52- public async insertDebugConfiguration (
49+ public static async insertDebugConfiguration (
5350 document : TextDocument ,
5451 position : Position ,
5552 config : DebugConfiguration ,
@@ -68,7 +65,7 @@ export class LaunchJsonUpdaterServiceHelper {
6865 const workspaceEdit = new WorkspaceEdit ( ) ;
6966 workspaceEdit . insert ( document . uri , position , formattedJson ) ;
7067 await applyEdit ( workspaceEdit ) ;
71- this . commandManager . executeCommand ( 'editor.action.formatDocument' ) . then ( noop , noop ) ;
68+ executeCommand ( 'editor.action.formatDocument' ) . then ( noop , noop ) ;
7269 }
7370
7471 /**
0 commit comments