From 4013c0fe51f29ee1cd509252ff4d2b8b4e798cb5 Mon Sep 17 00:00:00 2001 From: mstrong Date: Mon, 16 Jul 2018 14:26:05 -0500 Subject: [PATCH] Debugger compares length of bytes instead of length of string for hover output. Fixes #1777 --- src/debugAdapter/goDebug.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts index e252b991c..ad4361905 100644 --- a/src/debugAdapter/goDebug.ts +++ b/src/debugAdapter/goDebug.ts @@ -567,7 +567,7 @@ class GoDebugSession extends DebugSession { let clientVersion = this.delve.isApiV1 ? 1 : 2; if (out.APIVersion !== clientVersion) { logError(`Failed to get version: The remote server is running on delve v${out.APIVersion} API and the client is running v${clientVersion} API`); - return this.sendErrorResponse(response, + return this.sendErrorResponse(response, 3000, 'Failed to get version: The remote server is running on delve v{cli} API and the client is running v{ser} API', { ser: out.APIVersion.toString(), cli: clientVersion }); @@ -819,8 +819,8 @@ class GoDebugSession extends DebugSession { }; } else if (v.kind === GoReflectKind.String) { let val = v.value; - if (v.value && v.value.length < v.len) { - val += `...+${v.len - v.value.length} more`; + if (v.value && Buffer.byteLength(v.value) < v.len) { + val += `...+${v.len - Buffer.byteLength(v.value)} more`; } return { result: v.unreadable ? ('<' + v.unreadable + '>') : ('"' + val + '"'),