sourcegraph / go-langserver

Go language server to add Go support to editors and other tools that use the Language Server Protocol (LSP)
https://sourcegraph.com
MIT License
1.17k stars 89 forks source link

No symbols for file when methods are on a type defined in another file #311

Open ramya-rao-a opened 6 years ago

ramya-rao-a commented 6 years ago

In a package have 2 Go files

The first file:

package main

func main() {}
type foo int

The second file:

package main

func (*foo) Hello() {}
func (*foo) Bye()   {}

The symbol provider doesnt provide any symbols for the second file.

cc @harikb Related to https://github.com/Microsoft/vscode-go/issues/1864

lloiser commented 6 years ago

https://github.com/sourcegraph/go-langserver/blob/7df19dc017efdd578d75c81016e0b512f3914cc1/langserver/langserver_test.go#L1085-L1101

There is already a test case for this. Do you mean that in both files the symbols request should return Hello and Bye?

ramya-rao-a commented 6 years ago

Do you mean that in both files the symbols request should return Hello and Bye?

No. What we saw was there were no symbols being returned in the second file.

@harikb Can you update your language server and try again? To avoid the case that you have an older version of the tool?

harikb commented 6 years ago

@ramya-rao-a , it does seem to work after I updated the language server. I did not remember that language-server was installed via a separate go get command. Sorry about this. Although the UI appears slightly different. I guess that may be the difference with langage-server mode.

With language-server bc1

With-out language-server bc2

NOTE: The syntax error (red underline) shown on package main line is because of https://github.com/Microsoft/vscode-go/issues/1914 (unrelated to this issue). At the moment, vs code won't work for me until that is fixed. I will update this ticket after that spurious error is resolved.