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

add 2 snippets: impstd & importstd and import std module url completion #115

Closed
wants to merge 10 commits into from

Conversation

CGQAQ
Copy link
Contributor

@CGQAQ CGQAQ commented Jul 22, 2020

$0: denotes the final cursor position
$1..n: tabstops in sequence

impstd => import {$3} from 'https://deno/std@$1/$2';$0"
importstd => import (foo|{foo}| * as foo) from 'https://deno/std@$1/$2';$0"

  • fetch std library information dynamically from github
  • import completion
  • std version completion
  • cache the result
  • add command to clear the cache to allow user to refresh local import std cache

Screenshots:

image
image
image
image
image

Implementation of #114

CGQAQ added 4 commits July 22, 2020 16:24
$0: denotes the final cursor position
$1..n: tapstops in sequence

impstd =>  `import {$3} from 'https://deno/std@$1/$2';$0"`

importstd => `import (foo|{foo}| * as foo) from 'https://deno/std@$1/$2';$0"`
but need to cache it!
@CGQAQ CGQAQ changed the title add 2 snippets: impstd & importstd add 2 snippets: impstd & importstd and import completion Jul 22, 2020
CGQAQ added 2 commits July 23, 2020 11:38
* Cache the result to extension_context.globalState
as following format
key: [email protected]
value: [{name: *, type: ('file'|'dir'), url: *}]

* Now, completion item shows differently when import entry is folder or not
@CGQAQ CGQAQ changed the title add 2 snippets: impstd & importstd and import completion add 2 snippets: impstd & importstd and import std module url completion Jul 23, 2020
@lucacasonato
Copy link
Member

lucacasonato commented Aug 31, 2020

@CGQAQ Thanks, this is a cool feature. Since you implemented this a lot in this repository has changed, and also there has been a complete rewrite of the deno.land/x registry powering deno.land/std, so this PR will need some changes. If you want to continue that is cool, otherwise I can pick up this PR and finish it.

I think this feature could be extended to support all of deno.land/x, not just std with these new API endpoints on the registry:

  • https://cdn.deno.land/$MODULE/meta/versions.json to get a list of versions for a module
  • https://cdn.deno.land/$MODULE/versions/$VERSION/meta/meta.json to get a file tree of the module
  • https://api.deno.land/modules?limit=10&query=$QUERY to search deno.land/x

Also I think we should limit our cache to a max of 1 hour, after which we would lazily fetch new versions automatically.

@CGQAQ
Copy link
Contributor Author

CGQAQ commented Sep 1, 2020

@CGQAQ Thanks, this is a cool feature. Since you implemented this a lot in this repository has changed, and also there has been a complete rewrite of the deno.land/x registry powering deno.land/std, so this PR will need some changes. If you want to continue that is cool, otherwise I can pick up this PR and finish it.

I think this feature could be extended to support all of deno.land/x, not just std with these new API endpoints on the registry:

  • https://cdn.deno.land/$MODULE/meta/versions.json to get a list of versions for a module
  • https://cdn.deno.land/$MODULE/versions/$VERSION/meta/meta.json to get a file tree of the module
  • https://api.deno.land/modules?limit=10&query=$QUERY to search deno.land/x

Also I think we should limit our cache to a max of 1 hour, after which we would lazily fetch new versions automatically.

OK, I'll change it, thank you for your information

@CGQAQ CGQAQ closed this Sep 1, 2020
@CGQAQ CGQAQ mentioned this pull request Sep 1, 2020
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants