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

[pre version 2] Extension doesn't seem to do anything #80

Closed brundonsmith closed 4 years ago

brundonsmith commented 4 years ago

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

thezanke commented 4 years ago

I'm having the same problem

thezanke commented 4 years ago

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.

brundonsmith commented 4 years ago

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

bsunderhus commented 4 years ago

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. ๐Ÿคท๐Ÿผโ€โ™‚๏ธ

TTSKarlsson commented 4 years ago

I can confirm, not working for minimal setup either. (Using VSCode builtin typescript 3.9.4)

image

bsunderhus commented 4 years ago

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

FaberVitale commented 4 years ago

I did not have any issue with @axetroy version but this plugin doesn't work.

I have tried this but nothing has changed.

pic

Screenshot 2020-06-07 at 10 21 35

setting.json

 {
    "deno.enable": true,
    "editor.rulers": [80]
  }    

Vscode

David-Else commented 4 years ago

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?

digitalclover commented 4 years ago

I just installed the extension for the first time about an hour ago and experiencing the same issue.

Similar to @bsunderhus, I installed typescript-deno-plugin along with a workspace version of TypeScript v.3.9.5. Changing back to VSCode version v3.8.3 essentially disables the extension.

bsunderhus commented 4 years ago

Same here. I just installed this extension for the first today.

David-Else commented 4 years ago

I just checked, and now with the update the wrongly checking .js error is gone, but the extension is now is broken for me too. broken-code-deno

VictorLimou commented 4 years ago

It's the same for me, I'm also on MacOS, using VSCode TypeScript version and i've installed this plugin for the first time today (uninstalling the "deprecated" one just before). I already try to reload VSC, disable/enable the plugin, however it just doesn't work for me.

thezanke commented 4 years ago

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.

elnobun commented 4 years ago

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
melvin2016 commented 4 years ago

The extension doesn't do anything on macOS. No autocompletion. ๐Ÿ™

elnobun commented 4 years ago

The extension doesn't do anything on macOS. No autocompletion. ๐Ÿ™

@melvin2016, I get autocompletion after everything was fixed as I desribed above. :)

melvin2016 commented 4 years ago

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!

brundonsmith commented 4 years ago

Confirmed that @elnobun's fix worked for me

andylei commented 4 years ago

@elnobun's fix did not work for me unfortunately

TTSKarlsson commented 4 years ago

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

MejanH commented 4 years ago

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\\AppData\Roaming\npm\node_modules\typescript\lib" location

you can find your location here... image

TTSKarlsson commented 4 years ago

It worked for me in Windows 10... for those who installed typescript globally with npm package use the "C:\Users\AppData\Roaming\npm\node_modules\typescript\lib" location

@Mejanhaque , I think we all tried that. Are you sure you don't have a tsconfig.json that helps you out or other settings?

image

This setup does not work, as shown, with the denoland extension. (Windows 10)

MejanH commented 4 years ago

It worked for me in Windows 10... for those who installed typescript globally with npm package use the "C:\Users\AppData\Roaming\npm\node_modules\typescript\lib" location

@Mejanhaque , I think we all tried that. Are you sure you don't have a tsconfig.json that helps you out or other settings?

image

This setup does not work, as shown, with the denoland extension. (Windows 10)

No need tsconfig..check the sc below: image

TTSKarlsson commented 4 years ago

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.

kosciej commented 4 years ago

@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.

AQUIN0S commented 4 years ago

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

For those that used nvm to install node, it might be handy to note that the right directory is actually a slightly different path! The path you'll be looking for on MacOS would be "/Users/\<username>/.nvm/versions/node/\<default node version>/lib/node_modules/typescript/lib/"

ry commented 4 years ago

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

andyvanee commented 4 years ago

For reference, if anyone is using DevContainers, I got the extension working by adding the extension to devcontainer.json:

"extensions": ["denoland.vscode-deno"]

And then adding the full path to the lib directory in .vscode/settings.json:

"typescript.tsdk": "/root/.vscode-server/extensions/denoland.vscode-deno-1.24.0/server/node_modules/typescript/lib"
arantesxyz commented 4 years ago

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

fenilli commented 4 years ago

For reference, if anyone is using DevContainers, I got the extension working by adding the extension to devcontainer.json:

"extensions": ["denoland.vscode-deno"]

And then adding the full path to the lib directory in .vscode/settings.json:

"typescript.tsdk": "/root/.vscode-server/extensions/denoland.vscode-deno-1.24.0/server/node_modules/typescript/lib"

Using WSL2 and didn't work for me, still getting the same error.

pedropaulosuzuki commented 4 years ago

I have the same issue on Ubuntu 20.04 LTS, while on Windows 10 everything works fine.

scottjr632 commented 4 years ago

For those using WSL2.0, I got this plugin to work by globally installing the typescript-deno-plugin npm package and updating my typescript version with npm install -g typescript@latest

My tsconfig.json

{
    "compilerOptions": {
        "plugins": [
            {
                "name": "typescript-deno-plugin",
                "enable": true,
                "importmap": "import_map.json"
            }
        ]
    }
}

And my settings.json

{
    "deno.enable": true,
    // this is the path to your globally installed typescript
    "typescript.tsdk": "/home/scott/.npm-global/lib/node_modules/typescript/lib"
}

I also had to click on the typescript version at the bottom right and select use workspace version

Hope this helps someone because I spent way too much time trying to get this to work.

ry commented 4 years ago

possibly fixed now

Neale-Forrest commented 4 years ago

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

8x13b commented 4 years ago

macOS 13 High Sierra. Still broken.

sushruth commented 4 years ago

Issue is back on Windows as well currently with vscode@1.47.3 and this plugin @ 1.25.0

VScode seems to be using this typescript version (3.9.6) -

image

But deno plugin seems to be using this (3.9.2) -

image

Not sure what the exact paths being used for both ts versions are.

roman-kirsanov commented 4 years ago
Screenshot 2020-09-05 at 14 53 08 Screenshot 2020-09-05 at 14 52 49

Can I manually import Deno's lib, like import { Deno } from '...' ?

lucacasonato commented 4 years ago

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

MejanH commented 4 years ago
Screenshot 2020-09-05 at 14 53 08 Screenshot 2020-09-05 at 14 52 49

Can I manually import Deno's lib, like import { Deno } from '...' ?

Yes, you can. but I don't think its working with vscode "import" snippets. But if you manually write like import {} from "htt.." then the modules start to show up like the official gif plugin says. And also remember to enable deno in your project directory. I wrote an article about deno intellisense on vscode. You can check out the link below.

Deno Intellisense or Snippets for VS Code

roman-kirsanov commented 4 years ago

Yes, it correctly resolves imports like import * as Path from 'https://deno.land/std/path/mod.ts'; and Deno label is appeared in status bar

lucacasonato commented 4 years ago

What version of Deno are you using? What OS are you on? What VS Code version? What extension version?

Also you need to sometimes restart all VS Code windows after adding the "deno.enable": true setting before it will actually work.

roman-kirsanov commented 4 years ago

Deno 1.3.2 Catalina 10.15.6 Code 1.48.2

I also have this setting globally "typescript.tsdk": "/usr/local/lib/node_modules/typescript/lib",

lucacasonato commented 4 years ago

Did you restart VS Code after enabling the setting in .vscode/settings.json?

roman-kirsanov commented 4 years ago

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.

donaldoakes commented 4 years ago

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

kitsonk commented 4 years ago

@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.

FSou1 commented 3 years ago

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

Steps:

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).

michaeldebetaz commented 3 years ago

WSL2 Ubuntu, Deno 1.7.5, VS Code 1.53.2, JavaScript and TypeScript Nightly 4.3.20210223

Hi guys, I was screening this thread after installing Deno and its VS Code extension for the first time. I tried all that was mentionned above, but nothing worked. I was about to give up until I tried to downgrade from the current version (3.0.1) to the version 2.3.3.

Then I ran into the problem of deno not found in the $PATH, that was solved in the issue #234 which proposed to create a symbolic link with:

I had the same issue. I resolved it with:

  • sudo ln -s /home/losintikfos/.deno/bin/deno /usr/bin
  • Restart vscode.

And it worked! Then I tried to push my luck and updated The Deno extension again and everything finally worked.

Hope it could help someone.