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: bad completion with syntax errors #39721

Open
kzhui125 opened this issue Jun 19, 2020 · 5 comments
Open

x/tools/gopls: bad completion with syntax errors #39721

kzhui125 opened this issue Jun 19, 2020 · 5 comments

Comments

@kzhui125
Copy link

@kzhui125 kzhui125 commented Jun 19, 2020

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

  • Run go version to get version of Go
    • go version go1.14.3 darwin/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • 1.46.0
    • a5d1cc28bb5da32ec67e86cc50f84c67cc690321
    • x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.14.4

full code:

package main

import "fmt"

type result struct {
	value interface{}
	err   error
}

func getResult() (interface{}, error) {
	return "test", nil
}

func main() {
	var res result
	res.value, res.err = getResult()
	fmt.Println(res)
}

1

When I type "res.", I expect "err" will appear.

But now the code completion stop working, I have to type "err" manually.

Please fix the bug, thanks.

@kzhui125 kzhui125 closed this Jun 19, 2020
@kzhui125 kzhui125 changed the title no code intelessense no code completion Jun 19, 2020
@kzhui125 kzhui125 reopened this Jun 19, 2020
@kzhui125
Copy link
Author

@kzhui125 kzhui125 commented Jun 19, 2020

4

another problem: when I type tab here, I expect "getResult()" will appear, but only "getResult" appear now.

@kzhui125 kzhui125 changed the title no code completion missing code completion Jun 19, 2020
@hyangah
Copy link
Contributor

@hyangah hyangah commented Jun 19, 2020

@kzhui125 Thanks for the issue report.
Can you please run Preferences: Open Settings (JSON) command and Preferences: Open Workspace Settings (JSON) and share all the settings with the go. or ["go"] or gopls prefixes?

@kzhui125
Copy link
Author

@kzhui125 kzhui125 commented Jun 19, 2020

    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 300,
    "[golang]": {
        "editor.tabSize": 4,
        "editor.detectIndentation": false,
        "editor.insertSpaces": false,
    },
    "go.delveConfig": {
        "dlvLoadConfig": {
            "followPointers": true,
            "maxVariableRecurse": 1,
            "maxStringLen": 100000,
            "maxArrayValues": 1000,
            "maxStructFields": -1
        },
        "apiVersion": 2,
        "showGlobalVariables": true
    },
    "go.formatTool": "goimports",
    "go.useLanguageServer": true,
    "go.testFlags": [
        "-v"
    ],
    "go.languageServerFlags": [
        "-rpc.trace",
    ],
    "[go]": {
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true,
        },
    },
    "[go.mod]": {
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true,
        },
    },
    "gopls": {
        "usePlaceholders": true,
        "completeUnimported": true
    },
@kzhui125
Copy link
Author

@kzhui125 kzhui125 commented Jun 19, 2020

1

@hyangah
Copy link
Contributor

@hyangah hyangah commented Jun 19, 2020

Thanks @kzhui125!
/cc @stamblerre Can you please take a look and triage in gopls issue tracker? This issue discusses two symptoms and I guess the underlying problem is similar to #38600.

  1. missing completion.
  2. missing () even though "usePlaceholders": true is selected.
@stamblerre stamblerre changed the title missing code completion x/tools/gopls: bad completion with syntax errors Jun 19, 2020
@stamblerre stamblerre transferred this issue from golang/vscode-go Jun 19, 2020
@gopherbot gopherbot added this to the Unreleased milestone Jun 19, 2020
@golang golang deleted a comment from gopherbot Jun 19, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.5.0 Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.