vscode_deno: [pre version 2] Extension doesn't seem to do anything

I switched from one of the now-deprecated extensions, which was working, and this one isn’t working properly. In fact, it seems to have all the same errors that you get with plain TypeScript and no Deno extension:

main_ts_—_jlox_and_Issues_·_denoland_vscode_deno

On the references to Deno it says Cannot find name 'Deno'..

The extension is definitely active (I can see Deno 1.0.5 in the corner) and I’ve restarted my editor, upgraded to the latest deno runtime, etc.

Edit: In case it matters, I’m on macOS

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 46
  • Comments: 48 (6 by maintainers)

Most upvoted comments

Hi Everyone,

I just want to write and say that we (Deno Land) haven’t abandoned this extension module - we plan to work on these fixes - but as this is open source software, we just don’t have the resources to address these problems immediately. We hope to dedicate some time to this extension next week after the Deno 1.1.0 release.

If you do have the time to dig into this, PRs are very welcome.

Ryan

FIX (macOS)

Screenshot 2020-06-07 at 17 21 49

Upgrade to latest typescript > 3.9.5 globally

Sadly, VScode still used typescript 3.8.3

In the global settings.json file, force VScode to use the latest typescript.

 "typescript.tsdk": "/usr/local/lib/node_modules/typescript/lib/"

Now it’s working as expected.

Screenshot 2020-06-07 at 17 06 57

possibly fixed now

Okay, I ran into the issue again. What I had to do was:

$ npm install -g typescript@latest

and grab the path that it tells me it installed the bin files to, like "/Users/thezanke/.nvm/versions/node/v13.12.0/lib/node_modules/typescript/bin" and use that in my vscode settings.json like:

{
   "typescript.tsdk": "/Users/thezanke/.nvm/versions/node/v13.12.0/lib/node_modules/typescript/lib"
}

(note that I switched /bin to /lib after /typescript)

AND THEN I did what I mentioned earlier

click the typescript version number down on the bottom right, click “Select Typescript Version” and then “Use VSCode’s Version”.

make sure you click it even if it looks like it’s already selected.

This fixed it for me again, I didn’t think the settings.json had anything to do with it so I reverted it and on my next restart it stopped working.

I solved it!

Setting in workspace file is not respected.

I added .vscode/settings.json { “deno.enable”: true } to the root folder, where my *.ts files are actually located.

EDIT

Global settings are not respected also.

I figured out how to get mine to work, I had to click the typescript version number down on the bottom right, click “Select Typescript Version” and then “Use VSCode’s Version”. Once I did that everything started working properly. Not sure how it got changed to use any other version but there you have it.

I have just updated to v1.25.0 and it seems to be working for me now. This is on Windows 10 VS code V1.46.0

@elnobun’s fix did not work for me unfortunately

I wonder why this issue is closed. None of the workarounds described here succeeded for me on macOS Catalina with TypeScript 4.0.3.

The extension doesn’t work at all. I recommend you guys to use the “deprecated” (which looks to be less deprecated than the official) version: https://marketplace.visualstudio.com/items?itemName=justjavac.vscode-deno&ssr=false

So strange that the exact same thing only works for a few people. Maybe it doesn’t work on VSCode 1.46.0, because that’s what I’m using.

EDIT: Ok, figured out what we’re doing differently. It doesn’t work to force the library in the project settings.json under .vscode (Even though it let’s you choose the library you put there), only in the global settings.json.

FIX (macOS)

Screenshot 2020-06-07 at 17 21 49

Upgrade to latest typescript > 3.9.5 globally

Sadly, VScode still used typescript 3.8.3

In the settings.json file, force VScode to use the lastest typescript

 "typescript.tsdk": "/usr/local/lib/node_modules/typescript/lib/"

Now its working as expected

Screenshot 2020-06-07 at 17 06 57

It worked for me in Windows 10… for those who installed typescript globally with npm package use the “C:\Users<your username>\AppData\Roaming\npm\node_modules\typescript\lib” location

you can find your location here… image

This is how I made this work (VSCode 1.52.1).

Steps:

  • Install typescript globally $ npm install -g typescript@latest
  • Install the extension
  • Put the .vscode/settings.json to the root:
{
    "deno.enable": true,
    "typescript.tsdk": "C:/Users/myuser/AppData/Roaming/npm/node_modules/typescript/lib"
}
  • Restart the VSCode

Result: image

p.s. This will not work if the .vscode/settings.json is not in the root (e.g. in a subfolder next to *.ts files).

@elnobun’s fix did not work for me either. (Both Windows and Linux Remote)

I tried @thezanke’s suggestion. It seemed like I was already using VSCode’s version; either way, it didn’t solve the problem

@donaldoakes the causes of this issue simply cannot be causing the issue you are experiencing. The issues that let to the opening of this are resolved (which is why the issue was closed). Almost all of the work arounds listed here are for a very old version of the plugin and won’t be useful with current versions.

If you are having issues with the extension, join the chat on Discord or open an issue with more details than this, like version of Visual Studio Code and the version of the extension installed.

Did you enable the extension by adding "deno.enable": true in the .vscode/settings.json file? See https://github.com/denoland/vscode_deno#usage

@TTSKarlsson I’ve got VSCode 1.45.1 and your approach (global tsdk) works on my MacOS. Previous (workspace) solution didn’t work for me.

Confirmed that @elnobun’s fix worked for me

FIX (macOS)

Screenshot 2020-06-07 at 17 21 49

Upgrade to latest typescript > 3.9.5 globally

Sadly, VScode still used typescript 3.8.3

In the settings.json file, force VScode to use the lastest typescript

 "typescript.tsdk": "/usr/local/lib/node_modules/typescript/lib/"

Now its working as expected

Screenshot 2020-06-07 at 17 06 57

Thanks, @elnobun It is working now!

The new version of this extension was published to the Marketplace yesterday, but the update was not triggered by VS Code.

https://github.com/denoland/vscode_deno/pull/77

Completely uninstall your current version, close and open VS Code to make sure the cached version is deleted, and re-install. Now you have the update! The version number was not updated.

Does this fix it?

Using the typescript-deno-plugin solves the issue for me fortunately. Couldn’t debug enough this extension to find the cause of this 😦

I’m having the same issue. seems like the extension is simply not working, I’m developing in a devcontainer and it used to work fine with axetroy version. 🤷🏼‍♂️