Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

debug hover string variable ...more appears #1777

Closed
kzhui125 opened this issue Jul 8, 2018 · 5 comments
Closed

debug hover string variable ...more appears #1777

kzhui125 opened this issue Jul 8, 2018 · 5 comments

Comments

@kzhui125
Copy link

kzhui125 commented Jul 8, 2018

	s1 := "你好"
	s2 := "abc"
	fmt.Println(s1)
	fmt.Println(s2)

image

hover on s1, I get message "你好...+4 more"

“你好” is expected.

@ramya-rao-a ramya-rao-a changed the title hover string variable ...more appears debug hover string variable ...more appears Jul 10, 2018
@ramya-rao-a
Copy link
Contributor

That more is coming from https://github.com/Microsoft/vscode-go/blob/0.6.84/src/debugAdapter/goDebug.ts#L823

For s1, delve returns a string with length 6. The string itself is of length 2 and so the +4.

If anyone wants to take a look at how to fix this, then PRs are most welcome.
Wiki for Running the Go extension from source and debugging the debug adapter

@xmattstrongx
Copy link
Contributor

Hi Ramya. I am looking for something to help the vscode-go extension and I came across this issue. I have the debugging the debug adapter running and see the code in goDebug.ts hitting as you noted.

I am still trying to figure out why delve returns a string with length 6 even though the string is only length 2. Id be happy to submit a PR for this issue just a little confused on what the expected outcome of this issue is.

@kzhui125
Copy link
Author

kzhui125 commented Jul 16, 2018

@xmattstrongx

len("你好") is 6
len([]rune("你好")) is 2

https://blog.golang.org/strings

@ramya-rao-a
Copy link
Contributor

Looks like 6 is for the number of bytes and 2 is the number of characters.
Thanks for that link @kzhui125!

@ramya-rao-a
Copy link
Contributor

This fix is now out in the latest update (0.6.85) to the Go extension. Thanks @xmattstrongx!

@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants