2020-05-06 18:21:13 -04:00
|
|
|
## Setup your environment
|
|
|
|
|
|
|
|
To productively get going with Deno you should set up your environment. This
|
|
|
|
means setting up shell autocomplete, environmental variables and your editor or
|
|
|
|
IDE of choice.
|
|
|
|
|
|
|
|
### Environmental variables
|
|
|
|
|
|
|
|
There are several env vars that control how Deno behaves:
|
|
|
|
|
2020-05-26 07:12:07 -04:00
|
|
|
`DENO_DIR` defaults to `$HOME/.cache/deno` but can be set to any path to control
|
|
|
|
where generated and cached source code is written and read to.
|
2020-05-06 18:21:13 -04:00
|
|
|
|
|
|
|
`NO_COLOR` will turn off color output if set. See https://no-color.org/. User
|
|
|
|
code can test if `NO_COLOR` was set without having `--allow-env` by using the
|
|
|
|
boolean constant `Deno.noColor`.
|
|
|
|
|
|
|
|
### Shell autocomplete
|
|
|
|
|
|
|
|
You can generate completion script for your shell using the
|
|
|
|
`deno completions <shell>` command. The command outputs to stdout so you should
|
|
|
|
redirect it to an appropriate file.
|
|
|
|
|
|
|
|
The supported shells are:
|
|
|
|
|
|
|
|
- zsh
|
|
|
|
- bash
|
|
|
|
- fish
|
|
|
|
- powershell
|
|
|
|
- elvish
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
deno completions bash > /usr/local/etc/bash_completion.d/deno.bash
|
|
|
|
source /usr/local/etc/bash_completion.d/deno.bash
|
|
|
|
```
|
|
|
|
|
|
|
|
### Editors and IDEs
|
|
|
|
|
|
|
|
Because Deno requires the use of file extensions for module imports and allows
|
2020-05-14 14:10:25 -04:00
|
|
|
http imports, and most editors and language servers do not natively support this
|
|
|
|
at the moment, many editors will throw errors about being unable to find files
|
|
|
|
or imports having unnecessary file extensions.
|
2020-05-06 18:21:13 -04:00
|
|
|
|
|
|
|
The community has developed extensions for some editors to solve these issues:
|
|
|
|
|
2020-05-17 13:24:39 -04:00
|
|
|
#### VS Code
|
|
|
|
|
|
|
|
The beta version of [vscode_deno](https://github.com/denoland/vscode_deno) is
|
|
|
|
published on the
|
2020-05-27 01:06:08 -04:00
|
|
|
[Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno).
|
2020-05-17 13:24:39 -04:00
|
|
|
Please report any issues.
|
|
|
|
|
|
|
|
#### JetBrains IDEs
|
2020-05-06 18:21:13 -04:00
|
|
|
|
2020-05-26 13:11:08 -04:00
|
|
|
Support for JetBrains IDEs is available through
|
|
|
|
[the Deno plugin](https://plugins.jetbrains.com/plugin/14382-deno).
|
2020-05-06 18:21:13 -04:00
|
|
|
|
2020-05-26 13:11:08 -04:00
|
|
|
For more information on how to set-up your JetBrains IDE for Deno, read
|
|
|
|
[this comment](https://youtrack.jetbrains.com/issue/WEB-41607#focus=streamItem-27-4160152.0-0)
|
|
|
|
on YouTrack.
|
2020-05-06 18:21:13 -04:00
|
|
|
|
2020-05-17 13:24:39 -04:00
|
|
|
#### Vim and NeoVim
|
|
|
|
|
|
|
|
Vim works fairly well for Deno/TypeScript if you install
|
|
|
|
[CoC](https://github.com/neoclide/coc.nvim) (intellisense engine and language
|
|
|
|
server protocol). After CoC itself is installed, from inside Vim, simply run
|
|
|
|
`:CocInstall coc-deno`. From now on, things like `gd` (go to definition) and
|
|
|
|
`gr` (goto/find references) should work.
|
|
|
|
|
2020-05-06 18:21:13 -04:00
|
|
|
If you don't see your favorite IDE on this list, maybe you can develop an
|
|
|
|
extension. Our [community Discord group](https://discord.gg/TGMHGv6) can give
|
|
|
|
you some pointers on where to get started.
|