stamblerre / gocode

An autocompletion daemon for the Go programming language
MIT License
394 stars 28 forks source link

suggest: pick the last package in the returned list instead of the first #2

Closed fsouza closed 6 years ago

fsouza commented 6 years ago

This fixes the case where more than one package is returned (for example, when the package contains tests): because pos is set inside ParseFile, it will have a value that is valid only in the last visited package.

This is probably not the correct fix, because the documentation for ParseFile says it should be thread-safe, and the current version is not :(

fsouza commented 6 years ago

@stamblerre let me know if something else makes more sense or if you're already working on this issue :D

stamblerre commented 6 years ago

Thanks for pointing this out; I don't know how I missed the fact that ParseFile has to be thread-safe, totally my bad. I'll follow up with a fix for making this thread-safe.