DamnWidget / anaconda_go

AnacondaGO adds autocompletion, linting and IDE features for Golang to your Sublime Text 3
GNU General Public License v3.0
38 stars 6 forks source link

Feature request: add an import explicitly. #3

Open alecthomas opened 7 years ago

alecthomas commented 7 years ago

One thing I really like in GoSublime is the ability to explicitly add an import. It would be great if AnacondaGO supported that feature!

DamnWidget commented 7 years ago

Is not goimports making that feature irrelevant?

alecthomas commented 7 years ago

No, because it doesn't cover the use case of when you want to explore a package. For example, you remember that encoding/xml has a function to escape text, but you don't remember the exact name. By explicitly importing the package, you can then type xml.<tab> to explore the package. This can not be achieved with goimports because it relies on a fully qualified symbol to perform importing. That is, you would already need to know the symbol name ahead of time.

DamnWidget commented 7 years ago

For that specific use case you can use the AnacondaGO: Explore Packages command then write xml and look for the function in the list (that you can fuzzy search as well).

Will that cover the related use cases that this GoSublime feature covers?

alecthomas commented 7 years ago

Aaah. I'll take a look.

alecthomas commented 7 years ago

As discussed in Gitter, I was unable to test this due to an issue with indexing on OSX.

alecthomas commented 7 years ago

More discussion on Gitter (February 17, 2017 10:18 AM)

DamnWidget commented 7 years ago

I've been thinking about this and I think the best solution here is to make the completer smarter and able to complete things that are not in the buffer.

alecthomas commented 7 years ago

That would be ideal in my mind.