question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Installed VSCode plugin but still not able to catch deno syntax

See original GitHub issue

Following the tutorial in the docs:

const res = await fetch("https://jsonplaceholder.typicode.com/todos/1");
const body = new Uint8Array(await res.arrayBuffer());
await Deno.stdout.write(body);

I still get underline on the await:

'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module.ts(1375)

And underline on the Deno

Cannot find name 'Deno'.ts(2304)

while if I run the file with deno, it obv runs. But vscode underlines are very irritating as well as it is not giving any type suggestions for Deno object.

I installed the plugin Deno 1.32.0 by justjavac. I tried doing [command]+[p] and > Enable Deno, which says deno is already enabled.

I tried to find any similar issue but seems it’s not there while my issue is very basic regarding installation. I went through Readme but not able to solve the problem. Can you please help me what more I need to do to get it working?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:22 (5 by maintainers)

github_iconTop GitHub Comments

13reactions
teroykscommented, May 28, 2020

And underline on the Deno

Cannot find name 'Deno'.ts(2304)

I have this same issue in VS Code. I can see ‘Deno 1.0.2’ on the status bar, and other Deno syntax (such as import, await) seems to work (VS Code doesn’t report problems on them, only on the Deno name so far).

8reactions
TranXuanHoangcommented, Sep 22, 2020

I got the same phenomenal in which Deno code suggestion and autocompletion did not work after installing denoland’s vscode_deno. After trying around I found the following steps help VS Code understands Deno - though this isn’t a configuration recommended by the plugin’s official documentation

  • Create a directory named .vscode and then create a settings.json file inside that directory. Put the following JSON config in that file

    your-project-workspace/.vscode/settings.json

    {
      "deno.enable": true,
    }
    
  • Open VS Code Settings File > Preferences > Settings (or Ctr + , on Windows / Cmd + , on macOS). Search deno, then select Extensions > Deno fron the search result filter. image

  • Check the Controls whether Deno is enabled or not to enable Deno like the above image capture.

  • Restart VS Code, and hopefully Deno suggestion and autocompletion will work image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Visual Studio Code | Manual - Deno
The most direct way to do this is to use the Deno: Initialize Workspace Configuration from the vscode command palette. This will activate...
Read more >
Deno: VS Code typescript doesnt know ES6 - Stack Overflow
I am building an app with deno and typescript. As my IDE I'm using VS Code. When I'm trying to use modern javascript...
Read more >
Configure & use Deno's VSCode extension | The JS runtimes
The first step is to install the extension from VSCode marketplace. Open the extensions tab and search for deno: Installation of the extension...
Read more >
Language Server Extension Guide - Visual Studio Code
Language Server is a special kind of Visual Studio Code extension that powers the editing ... and any LSP-compliant code editors can easily...
Read more >
Getting Started - ESBuild
#Install esbuild. First, download and install the esbuild command locally. A prebuilt native executable can be installed using npm (which is automatically ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found