This can be solved by installing and configuring the Deno Extensions for VSCode.
Press CtrlShiftX to open the extensions view,
then type "deno" and click on the entry name "Deno - Deno support for VSCode":
and install it.
After installation, you can choose any one of following methods:
- Go to settings: (Ctrl, or Cmd, on MacOSX), select "Extensions>Deno" and click on the checkbox under "Deno:Enable" and "Deno:lint"
- Just enable workspace settings only
- Don't enable User settings if you have other Non node projects
- Or, as @hong4rc mentioned, open the Command Palette(Ctrl+Shift+P) and select
Deno:initialize
Either method creates a folder named .vscode
and a file settings.json
with the following lines in your workspace project ( workspace settings):
{
"deno.enable": true,
"deno.lint": true
}
In both cases, after restarting Visual Studio Code, the error should be gone.
Ctrl+Shift+P
and type deno init (it auto enable another setting, just remove if you want) – Rompers