Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: incorrectly added type conversion #44066

Closed
islishude opened this issue Feb 2, 2021 · 3 comments
Closed

x/tools/gopls: incorrectly added type conversion #44066

islishude opened this issue Feb 2, 2021 · 3 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@islishude
Copy link

For asking questions, see:

Before filing an issue, please review our troubleshooting guides

Please answer these questions before submitting your issue. Thanks!

What version of Go, VS Code & VS Code Go extension are you using?

  • Run go version to get version of Go from the VS Code integrated terminal.
    go version go1.15.7 darwin/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    Build info

golang.org/x/tools/gopls v0.6.4
golang.org/x/tools/gopls@v0.6.4 h1:PO8rURGmi+QEKZ3pk+ZXJh51EFTVTSXqxzoRzrGSTJM=
github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/google/go-cmp@v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
golang.org/x/mod@v0.4.0 h1:8pl+sMODzuvGJkmj2W4kZihvVb5mKm8pB/X44PIQHv8=
golang.org/x/sync@v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
golang.org/x/sys@v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k=
golang.org/x/tools@v0.1.1-0.20210119222907-0a1a9685734a h1:ttr/sghFptib3jlHwNS65KwGoqjr03TFzso3kpHyia8=
golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
honnef.co/go/tools@v0.0.1-2020.1.6 h1:W18jzjh8mfPez+AwGLxmOImucz/IFjpNlrKVnaj2YVc=
mvdan.cc/gofumpt@v0.1.0 h1:hsVv+Y9UsZ/mFZTxJZuHVI6shSQCtzZ11h1JEFPAZLw=
mvdan.cc/xurls/v2@v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=

  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    1.52.1
    ea3859d4ba2f3e577a159bc91e3074c5d85c0523
    x64
  • Check your installed extensions to get the version of the VS Code Go extension
    v0.22.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.

Describe the bug

A clear and concise description of what the bug.
A clear and concise description of what you expected to happen.

Steps to reproduce the behavior:

package main

func main() {
	var i float64

	var j struct {
		f float64
	}

	if i == 100 {

	}
}

change i to j.f and get flowing

Screenshots or recordings

截屏2021-02-02 下午9 22 27

截屏2021-02-02 下午9 22 41

@hyangah
Copy link
Contributor

hyangah commented Feb 2, 2021

Thanks for the report @islishude. This is clearly a bug in gopls. I am transferring this issue to the gopls issue tracker. Here is the gopls trace - see the textDocument/completion response.

[Trace - 10:33:18.094 AM] Sending request 'textDocument/completion - (25)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/tmp/c/main.go"},"position":{"line":9,"character":6},"context":{"triggerKind":2,"triggerCharacter":"."}}


[Trace - 10:33:18.096 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/hakim/tmp/c/main.go","version":4,"diagnostics":[{"range":{"start":{"line":9,"character":7},"end":{"line":9,"character":7}},"severity":1,"source":"syntax","message":"expected selector or type assertion, found '=='"}]}


[Trace - 10:33:18.098 AM] Received response 'textDocument/completion - (25)' in 4ms.
Result: {"isIncomplete":true,
"items":[{
  "label":"f","kind":5,"detail":"float64","preselect":true,"sortText":"00000","filterText":"f)",
  "insertTextFormat":2,
  "textEdit":{"range":{"start":{"line":9,"character":6},"end":{"line":9,"character":6}},"newText":"f)"},
  "additionalTextEdits":[{"range":{"start":{"line":9,"character":4},"end":{"line":9,"character":4}},
    "newText":"untyped int("}]}]}

@hyangah hyangah changed the title gopls incorrectly added type conversion x/tools/gopls: incorrectly added type conversion Feb 2, 2021
@hyangah hyangah transferred this issue from golang/vscode-go Feb 2, 2021
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Feb 2, 2021
@gopherbot gopherbot added this to the Unreleased milestone Feb 2, 2021
@stamblerre stamblerre modified the milestones: Unreleased, gopls/unplanned Feb 2, 2021
@stamblerre stamblerre added the NeedsFix The path to resolution is known, but the work has not been done. label Feb 2, 2021
@stamblerre
Copy link
Contributor

/cc @muirdm

@gopherbot
Copy link

Change https://golang.org/cl/289129 mentions this issue: internal/lsp/completion: fix untyped ints to match floats

@golang golang locked and limited conversation to collaborators Feb 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants