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

Fix: convert fillstruct's output to character offset#2611

Merged
ramya-rao-a merged 4 commits intomicrosoft:masterfrom
stdupp:master
Apr 19, 2020
Merged

Fix: convert fillstruct's output to character offset#2611
ramya-rao-a merged 4 commits intomicrosoft:masterfrom
stdupp:master

Conversation

@stdupp
Copy link
Copy Markdown
Contributor

@stdupp stdupp commented Jun 28, 2019

The 'start', 'end' filed in fillstruct output is byte offset, but the parameter of 'editor.document.positionAt' is character offset, so if a source code include multi-byte string, vscode can't fill the struct into the right position.

stdupp added 2 commits June 28, 2019 13:11
Change-Id: Ie15d7e27e0c9ad026b1c8896684851b9103e045e
Change-Id: I1470c9323cae759f1e18b4639acb09bc06c5cb6e
@stdupp
Copy link
Copy Markdown
Contributor Author

stdupp commented Jun 28, 2019

PTAL @ramya-rao-a

@nicoxb
Copy link
Copy Markdown

nicoxb commented Nov 12, 2019

there was a conflict, and not merged?

@stdupp
Copy link
Copy Markdown
Contributor Author

stdupp commented Nov 12, 2019

I think the CI build problem is not caused by this pr, please take a look @ramya-rao-a

@nicoxb
Copy link
Copy Markdown

nicoxb commented Dec 11, 2019

problem not fixed yet!

@ramya-rao-a
Copy link
Copy Markdown
Contributor

@stdupp, @nicoxb Can either of you provide a small code snippet where we can try to replicate the problem?

@nicoxb
Copy link
Copy Markdown

nicoxb commented Dec 12, 2019

@ramya-rao-a Hi, there are some code snippet:

type User struct {
	ID   int64
	Name string
	Age  int
}
// expected
func foo1() {
	u := &User{
		ID:   0,
		Name: "",
		Age:  0,
	}
	fmt.Println(u)
}

// unexpected
func foo2() {
	// multi-byte char
	// 多字节字符
	u := &User{}
	fmUser{
		ID:   0,
		Name: "",
		Age:  0,
	}tln(u)
}

Copy link
Copy Markdown
Contributor

@ramya-rao-a ramya-rao-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @stdupp and @nicoxb
I pushed a commit to resolve the merge conflicts

@ramya-rao-a ramya-rao-a merged commit 6c737b3 into microsoft:master Apr 19, 2020
@ramya-rao-a
Copy link
Copy Markdown
Contributor

ramya-rao-a commented May 13, 2020

The latest update 0.14.2 has this fix, Thanks @stdupp!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants