denoland / vscode_deno

Visual Studio Code plugin for Deno
https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno
MIT License
1.48k stars 144 forks source link

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

Closed danilosampaio closed 4 years ago

danilosampaio commented 4 years ago

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,
    }
  4. create a .ts file
  5. 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 commented 4 years ago

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

axetroy commented 4 years ago

confirmed! The BUG should be here

https://github.com/denoland/vscode_deno/blob/6d7295be794b189b8b17565799cc2f7648f5f276/server/src/language/completion.ts#L18-L24

https://github.com/denoland/vscode_deno/blob/6d7295be794b189b8b17565799cc2f7648f5f276/core/deno_deps.ts#L32-L36

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

danilosampaio commented 4 years ago

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

danilosampaio commented 4 years ago

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