saibing / bingo

Bingo is a Go language server that speaks Language Server Protocol.
MIT License
495 stars 25 forks source link

auto completion doesn't work inside Goroutines. #166

Closed OneOfOne closed 5 years ago

OneOfOne commented 5 years ago

Related:

saibing commented 5 years ago

@OneOfOne

bingo's auto completion works well inside Goroutine.

Can you give me a specific scene example that bingo does not?

OneOfOne commented 5 years ago
┏━ oneofone@Ava ❰✪/s/bingo❱ ❰master|✔❱
┗━● git describe --always
65a1d72 << bingo commit

┏━ oneofone@Ava ❰/t/x❱
┗━● cat go.mod
module x
go 1.13

┏━ oneofone@Ava ❰/t/x❱
┗━● cat main.go
package main

import "bufio"

func main() {
    br := bufio.NewReader(nil)
    go func() {
        br.
    }()
}

Settings:

"go.alternateTools": {
    "go-langserver": "bingo"
},
"go.useLanguageServer": true,
"go.languageServerFlags": ["-enhance-signature-help"],
"go.languageServerExperimentalFeatures": {
    "format": true,
    "autoComplete": true,
    "rename": true,
    "goToDefinition": true,
    "hover": true,
    "signatureHelp": true,
    "goToTypeDefinition": true,
    "goToImplementation": true,
    "documentSymbols": true,
    "workspaceSymbols": true,
    "findReferences": true
},

Screenshot_20190321_195457 Screenshot_20190321_195515

OneOfOne commented 5 years ago

Looking at vscode go-langserver's output, I got this:

[Error - 7:59:54 PM] Request textDocument/signatureHelp failed.
  Message: the enclosing function is malformed
  Code: 0 
[Error - 8:00:01 PM] Request textDocument/formatting failed.
  Message: /tmp/x/main.go:9:2: expected selector or type assertion, found '}' (and 1 more errors)
  Code: 0 
OneOfOne commented 5 years ago

removing the go keyword fixes it.

inliquid commented 5 years ago

Same in defer statements.

imjustfly commented 5 years ago

According to https://github.com/golang/go/issues/29313, this is a special case, which needs workaround.

saibing commented 5 years ago

@OneOfOne @inliquid @imjustfly

I have fixed it, please try latest version bingo.

oblitum commented 5 years ago

Maybe this issue has some relation with this other.