Deno support for VSCode: github.com/justjavac/v .

Deno has attracted a lot of attention since its release, with many media outlets and developers calling it the “next generation node.js.” However, Deno aims to be node.js incompatible, no NPM, no package.json.

The goal of Deno is to provide a browser-compatible platform, so Deno can load Modules through urls like the browser’s ES Modules:

import * as log from "https://deno.land/x/std/log/mod.ts";
Copy the code

And do not omit the extension when loading the module.

However, all current development tools are built for Node.js. In TypeScript, we don’t need to add the.ts extension. If we do, VS Code will give us an error message:

ts(2691): An import path cannot end with a ‘.ts’ extension. Consider importing ‘./hello’ instead.

Another problem is that Deno can load remote modules, but TypeScript can’t. For example, the above code will also report an error:

ts(2307): Cannot find module ‘https://deno.land/x/std/log/mod’.

This plugin addresses both of these issues.

However, these two errors are not provided by VS Code, but by TSC, the TypeScript compiler, so you need to change TSC’s functionality. The good news is that TypeScript has supported the Language Service Plugin since 2.3. This feature only enhances the editing experience, not changes the core TypeScript behavior (such as changing type checking behavior) or adds new features (such as providing a new syntax or syntax). Looking at the documentation for the Language Service Plugin, THIS feature is exactly what I need.

So before writing this VS Code plug-in, I wrote another plugin for TypeScript: typescript-deno-plugin. This plugin works not only with VS Code, but with any typescript-enabled editor, such as Atom, Visual Studio, WebStorm, etc.

The VS Code plugin provides Deno support out of the box and requires no configuration, but there is one caveat: developers need to use VS Code’s built-in TypeScript. If you install TypeScript in your project and change the configuration of VS Code to use the version you installed, you need to install and configure the typescript-deno-plugin yourself. By modifying tsconfig.json plugins:

{
  "compilerOptions": {
    "plugins": [{"name": "typescript-deno-plugin"}}}]Copy the code

If you are planning to learn about Deno development, you can install the plugin by using the link Deno support for VSCode.

Have a nice development.