Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

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

Open
ramya-rao-a opened this issue Aug 23, 2018 · 3 comments
Open

Comments

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Aug 23, 2018

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 microsoft/vscode-go#1864

@lloiser
Copy link
Contributor

lloiser commented Aug 27, 2018

"recv in different file": {
rootURI: "file:///src/test/pkg",
fs: map[string]string{
"abc.go": `package a
type XYZ struct {}
`,
"bcd.go": `package a
func (x XYZ) ABC() {}
`,
},
cases: lspTestCases{
wantSymbols: map[string][]string{
"abc.go": []string{"/src/test/pkg/abc.go:class:XYZ:2:6"},
"bcd.go": []string{"/src/test/pkg/bcd.go:method:XYZ.ABC:2:14"},
},
},
},

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
Copy link
Contributor Author

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
Copy link

harikb commented Sep 5, 2018

@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 microsoft/vscode-go#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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants