saibing / bingo

Bingo is a Go language server that speaks Language Server Protocol.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

auto completion doesn't work inside Goroutines.

OneOfOne opened this issue · comments

@OneOfOne

bingo's auto completion works well inside Goroutine.

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

┏━ 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

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 

removing the go keyword fixes it.

Same in defer statements.

commented

According to golang/go#29313, this is a special case, which needs workaround.

@OneOfOne @inliquid @imjustfly

I have fixed it, please try latest version bingo.

Maybe this issue has some relation with this other.