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

Import autocomplete crashes when the deno/deps doesn't exists #158

Closed
danilosampaio opened this issue Aug 27, 2020 · 4 comments · Fixed by #169
Closed

Import autocomplete crashes when the deno/deps doesn't exists #158

danilosampaio opened this issue Aug 27, 2020 · 4 comments · Fixed by #169

Comments

@danilosampaio
Copy link
Contributor

A Deno fresh install doens't creates the deno/deps automatically, so that vscode_deno plugin crashes when trying to show module suggestions.

[Error - 11:33:20] Request textDocument/completion failed. Message: Request textDocument/completion failed with message: ENOENT: no such file or directory, scandir 'C:\Users\danilo\AppData\Local\deno\deps' Code: -32603

To Reproduce

  1. install deno (a new fresh install, without any deps)
  2. install vscode_deno plugin
  3. create a settings file (.vscode/settings.json)
{
  "deno.enable": true,
}
  1. create a .ts file
  2. try to autocomplete import * as test from 'http'

Expected behavior

Show module suggestions.

Screenshots

vscode_deno_error

Versions

vscode: 1.42.2
deno: 1.3.1
extension: 2.0.13

@buttercubz
Copy link

@danilosampaio try to call the file using absolute paths ./anyfile.ts

@axetroy
Copy link
Contributor

axetroy commented Aug 28, 2020

confirmed! The BUG should be here

getAllDenoCachedDeps()
.then((deps) => {
cache.set(deps);
})
.catch(() => {
// do nothing
});

export async function getAllDenoCachedDeps(): Promise<Deps[]> {
const depsRootDir = getDenoDepsDir();
const deps: Deps[] = [];
const protocols = await fs.readdir(depsRootDir);

I will fix it later, or if someone does it, that's even better

@danilosampaio
Copy link
Contributor Author

@axetroy thanks for you feedback.
i'd like to to my first contribution :)

danilosampaio pushed a commit to danilosampaio/vscode_deno that referenced this issue Aug 31, 2020
…es not exists

It handles ENOENT error thrown by the getAllDenoCachedDeps function when
the deno/deps directory does not exists (e.g. a deno fresh install).

Fix denoland#158
@danilosampaio
Copy link
Contributor Author

@axetroy fix it with PR #169
thanks for your help.

lucacasonato pushed a commit that referenced this issue Sep 3, 2020
…xists (#169)

Co-authored-by: Jose Danilo Sampaio da Silva (Venturus) <jose.sampaio@dmz.org.br>
axetroy pushed a commit to axetroy/vscode_deno that referenced this issue Sep 5, 2020
…es not exists (denoland#169)

Co-authored-by: Jose Danilo Sampaio da Silva (Venturus) <jose.sampaio@dmz.org.br>
CGQAQ pushed a commit to CGQAQ/vscode_deno that referenced this issue Sep 13, 2020
…es not exists (denoland#169)

Co-authored-by: Jose Danilo Sampaio da Silva (Venturus) <jose.sampaio@dmz.org.br>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants