Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-complete package names in pubspec.yaml #101

Closed
jrote1 opened this issue Aug 16, 2016 · 16 comments
Closed

Auto-complete package names in pubspec.yaml #101

jrote1 opened this issue Aug 16, 2016 · 16 comments
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is enhancement
Milestone

Comments

@jrote1
Copy link
Contributor

jrote1 commented Aug 16, 2016

No description provided.

@DanTup DanTup modified the milestone: v1.0 Aug 16, 2016
@jrote1
Copy link
Contributor Author

jrote1 commented Aug 16, 2016

A dart package that uses the pub.dartlang.org api https://github.com/jimsimon/pub_client

@jrote1
Copy link
Contributor Author

jrote1 commented Aug 16, 2016

I will look into doing this

@DanTup
Copy link
Member

DanTup commented Aug 16, 2016

Strange that there's no search API or ability to download the entire list; seems like we'd have to download them all page-at-a-time and cache them somewhere? :(

@jrote1
Copy link
Contributor Author

jrote1 commented Aug 16, 2016

they have a custom search endpoint not sure if we can use that
https://github.com/dart-lang/pub-dartlang/blob/master/app/handlers/search.py

@jrote1
Copy link
Contributor Author

jrote1 commented Aug 16, 2016

I have started investigation it and they use google apis

@jrote1
Copy link
Contributor Author

jrote1 commented Aug 16, 2016

I have figured it out, this is the endpoint but we require a google api key, https://www.googleapis.com/customsearch/v1?cx=009011925481577436976:h931xn2j7o0&q=angular&key=

@DanTup
Copy link
Member

DanTup commented Aug 16, 2016

Hmmm, maybe pulling down a list and caching it would be best. Maybe worth seeing if we can find anyone else already providing this functionality and what they do.

I wonder if @devoncarew might have any suggestions on what would be best (and whether anyone else is doing it)?

@jrote1
Copy link
Contributor Author

jrote1 commented Aug 16, 2016

Caching does sound like the best option, but when should be refresh the cache :/

@DanTup
Copy link
Member

DanTup commented Aug 16, 2016

Maybe depends on how big it is/how long it takes to download! If it doesn't take long to fetch, maybe refreshing at activating (in BG) if it's more than 24hrs old?

@devoncarew
Copy link
Contributor

No one else is doing it that I know of :) The old Dart Editor did use to do keyword completion for pubspec files, but not package name completion. I wonder if the built-in lexical completion is sufficient here?

@DanTup
Copy link
Member

DanTup commented Aug 16, 2016

I think the built-in completion is based on words already in the doc, so likely useless?

That said; although I think this would make a nice feature, I don't want to include if we can't make it work really well. I really want to Dart Code to be rock solid so fewer potential issues wins over more features.

@jrote1 If you think you can make it work well, do try it out by all means; but if you think we might struggle to make it rock solid and reliable, maybe worth reconsidering!

@jrote1
Copy link
Contributor Author

jrote1 commented Aug 16, 2016

@DanTup I would never issue a pull request if I wasn't confident if what I have written is reliable.

I have come up with a solution on how to make it reliable, we can cache all the packages at the first run and then when they begin adding a new package we get any packages that have been added/modified since the last time we updated the cache, then versions can also be cached in the same way or we retreive them when have entered the package name, either way will work for version.

@DanTup
Copy link
Member

DanTup commented Aug 16, 2016

I would never issue a pull request if I wasn't confident if what I have written is reliable.

I didn't mean to suggest you might send ropey code, I meant if the idea/mechanism is unreliable. Eg. if we can't guarantee the search will be available, or it's too slow or has other issues outside of our control.

we get any packages that have been added/modified since the last time we updated the cache

Sounds reasonable! I didn't see an API for something like that, is there one?

then versions can also be cached in the same way or we retreive them when have entered the package name, either way will work for version

Possibly caching for a short period could be good (so if you select the wrong one and go back to correct, we have the data) but version numbers seem like the sort of thing that could change often.

Have a go; will be a neat feature if we can make it work. I think MS did something similar for their packages.json (though they had the luxury of being able to create specific search endpoints!).

@DanTup DanTup modified the milestones: v1.0, Post v1.0 Sep 9, 2016
@DanTup DanTup added the in editor Relates to code editing or language features label Jun 24, 2017
@DanTup DanTup removed this from the Future milestone Jul 6, 2017
@DanTup DanTup added this to the Backlog milestone Feb 21, 2018
@DanTup DanTup added the blocked on dart / flutter Requires a change in Dart or Flutter to progress label Apr 2, 2018
@DanTup DanTup changed the title Add predictions to dependencies in pubspec.yaml Auto-complete package names in pubspec.yaml Oct 29, 2019
@DanTup DanTup modified the milestones: Backlog, v3.7.0 Oct 29, 2019
@DanTup DanTup modified the milestones: v3.7.0, v3.8.0 Nov 19, 2019
@DanTup DanTup modified the milestones: v3.8.0, v3.9.0 Jan 2, 2020
@DanTup DanTup modified the milestones: v3.9.0, On Deck Mar 11, 2020
@DanTup DanTup modified the milestones: On Deck, Backlog Jul 2, 2020
@DanTup DanTup added in lsp/analysis server Something to be fixed in the Dart analysis server and removed blocked on dart / flutter Requires a change in Dart or Flutter to progress labels Sep 1, 2020
@DanTup DanTup modified the milestones: Backlog, On Deck Nov 19, 2020
@DanTup DanTup modified the milestones: On Deck, v3.21.0 Mar 1, 2021
@DanTup
Copy link
Member

DanTup commented Mar 4, 2021

This is done in dart-lang/sdk@d901f73.

(It'll arrive in a future SDK update).

@HerrNiklasRaab
Copy link

@DanTup This is a very nice feature!

But I think every autocomplete suggestion should include the latest available version.

@DanTup
Copy link
Member

DanTup commented Apr 8, 2021

There's an open issue at #2078 about versions. I do have a working PoC for it, but I haven't had changed to finish it off and land it yet. Subscribe there for updates :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is enhancement
Projects
None yet
Development

No branches or pull requests

4 participants