debugAdapter: fix missing file bug for remote debugging
Check if the path is non-empty in `inferRemotePathFromLocalPath`
Fixes golang/vscode-go#1447
Change-Id: I151d6cb1109aacefd38ea5ba4fc832434951595c
GitHub-Last-Rev: c95fc42e885362f32efa873b2eeefd4b2c7af749
GitHub-Pull-Request: golang/vscode-go#1455
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/314190
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts
index 882b522..4beb6bc 100644
--- a/src/debugAdapter/goDebug.ts
+++ b/src/debugAdapter/goDebug.ts
@@ -1131,6 +1131,11 @@
* Cache the result in remoteToLocalPathMapping.
*/
protected inferLocalPathFromRemotePath(remotePath: string): string | undefined {
+ // Don't try to infer a path for a file that does not exist
+ if (remotePath === '') {
+ return remotePath;
+ }
+
if (this.remoteToLocalPathMapping.has(remotePath)) {
return this.remoteToLocalPathMapping.get(remotePath);
}