33 * SPDX-License-Identifier: Apache-2.0
44 */
55
6- import * as fs from 'fs-extra'
76import * as path from 'path'
87import * as vscode from 'vscode'
98import * as nls from 'vscode-nls'
@@ -36,6 +35,7 @@ import globals from '../../../shared/extensionGlobals'
3635import { VueWebview } from '../../../webviews/main'
3736import { Commands } from '../../../shared/vscode/commands2'
3837import { telemetry } from '../../../shared/telemetry/telemetry'
38+ import { fs } from '../../../shared'
3939
4040const localize = nls . loadMessageBundle ( )
4141
@@ -220,7 +220,7 @@ export class SamInvokeWebview extends VueWebview {
220220 * @param config Config to save
221221 */
222222 public async saveLaunchConfig ( config : AwsSamDebuggerConfiguration ) : Promise < void > {
223- const uri = getUriFromLaunchConfig ( config )
223+ const uri = await getUriFromLaunchConfig ( config )
224224 if ( ! uri ) {
225225 // TODO Localize
226226 void vscode . window . showErrorMessage (
@@ -289,7 +289,7 @@ export class SamInvokeWebview extends VueWebview {
289289 resolveWorkspaceFolderVariable ( undefined , config ) ,
290290 'Editor-Created Debug Config'
291291 )
292- const targetUri = getUriFromLaunchConfig ( finalConfig )
292+ const targetUri = await getUriFromLaunchConfig ( finalConfig )
293293 const folder = targetUri ? vscode . workspace . getWorkspaceFolder ( targetUri ) : undefined
294294
295295 // Cloud9 currently can't resolve the `aws-sam` debug config provider.
@@ -321,7 +321,7 @@ export function registerSamInvokeVueCommand(context: ExtContext): vscode.Disposa
321321 } )
322322}
323323
324- function getUriFromLaunchConfig ( config : AwsSamDebuggerConfiguration ) : vscode . Uri | undefined {
324+ async function getUriFromLaunchConfig ( config : AwsSamDebuggerConfiguration ) : Promise < vscode . Uri | undefined > {
325325 let targetPath : string
326326 if ( isTemplateTargetProperties ( config . invokeTarget ) ) {
327327 targetPath = config . invokeTarget . templatePath
@@ -342,7 +342,7 @@ function getUriFromLaunchConfig(config: AwsSamDebuggerConfiguration): vscode.Uri
342342 const workspaceFolders = vscode . workspace . workspaceFolders || [ ]
343343 for ( const workspaceFolder of workspaceFolders ) {
344344 const absolutePath = tryGetAbsolutePath ( workspaceFolder , targetPath )
345- if ( fs . pathExistsSync ( absolutePath ) ) {
345+ if ( await fs . exists ( absolutePath ) ) {
346346 return vscode . Uri . file ( absolutePath )
347347 }
348348 }
0 commit comments