-
Notifications
You must be signed in to change notification settings - Fork 155
/
Copy pathREADME.md
174 lines (143 loc) · 8.4 KB
/
README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# Deno for Visual Studio Code





<img align="right" src=https://raw.githubusercontent.com/denoland/vscode_deno/main/deno.png height="150px">
This extension adds support for using [Deno](https://deno.land/) with Visual
Studio Code, powered by the Deno language server.
> ⚠️ **Important:** You need to have a version of Deno CLI installed (v1.13.0 or
> later). The extension requires the executable and by default will use the
> environment path. You can explicitly set the path to the executable in Visual
> Studio Code Settings for `deno.path`.
>
> [Check here](https://deno.land/#installation) for instructions on how to
> install the Deno CLI.

## Features
- Type checking for JavaScript and TypeScript, including quick fixes, hover
cards, intellisense, and more.
- Integrates with the version of the Deno CLI you have installed, ensuring there
is alignment between your editor and the Deno CLI.
- Resolution of modules in line with Deno CLI's module resolution strategy
allows caching of remote modules in Deno CLI's cache.
- Integration to Deno CLI's linting functionality, including inline diagnostics
and hover cards.
- Integration to Deno CLI's formatting functionality.
- Allow specifying of import maps and TypeScript configuration files that are
used with the Deno CLI.
- [Auto completion for imports](./docs/ImportCompletions.md).
- [Workspace folder configuration](./docs/workspaceFolders.md).
- [Testing Code Lens](./docs/testing.md).
- [Provides Tasks for the Deno CLI](./docs/tasks.md).
## Usage
1. Install the Deno CLI.
2. Install this extension.
3. Ensure `deno` is available in the environment path, or set its path via the
`deno.path` setting in VSCode.
4. Open the VS Code command palette with `Ctrl+Shift+P`, and run the _Deno:
Initialize Workspace Configuration_ command.
We recognize that not every TypeScript/JavaScript project that you might work on
in VSCode uses Deno — therefore, by default, this extension will only apply the
Deno language server when the setting `deno.enable` is set to `true`. This can
be done via editing the settings or using the command _Deno: Initialize
Workspace Configuration_.
While you can enable Deno globally, you probably only want to do that if every
JavaScript/TypeScript workspace you work on in VSCode is a Deno based one.
## Commands
The extension provides several commands:
- _Deno: Cache_ - instructs Deno to fetch and cache all the dependencies of the
current file open in the editor. This is similar to doing `deno cache` on the
command line. Deno will not automatically fetch and cache remote dependencies.
> ℹ️ If there are missing dependencies in a module, the extension will
> provide a quick fix to fetch and cache those dependencies, which invokes
> this command for you.
- _Deno: Initialize Workspace Configuration_ - will enabled Deno on the current
workspace and allow you to choose to enable linting and Deno _unstable_ API
options.
- _Deno: Language Server Status_ - displays a page of information about the
status of the Deno Language Server. Useful when submitting a bug about the
extension or the language server. _ _Deno: Reload Import Registries Cache_ -
reload any cached responses from the configured import registries.
- _Deno: Welcome_ - displays the information document that appears when the
extension is first installed.
## Formatting
The extension provides formatting capabilities for JavaScript, TypeScript, JSX,
and TSX documents. When choosing to format a document or setting up a default
formatter for these type of files, the extension should be listed as an option.
> ℹ️ It does not currently provide format-on-paste or format-on-type
> capabilities.
## Configuration
You can control the settings for this extension through your VS Code settings
page. You can open the settings page using the `Ctrl+,` keyboard shortcut. The
extension has the following configuration options:
- `deno.enable`: Controls if the Deno Language Server is enabled. When enabled,
the extension will disable the built-in VSCode JavaScript and TypeScript
language services, and will use the Deno Language Server (`deno lsp`) instead.
_boolean, default `false`_
- `deno.path`: A path to the `deno` executable. If unset, the extension will use
the environment path to resolve the `deno` executable. If set, the extension
will use the supplied path. The path should include the executable name (e.g.
`/usr/bin/deno`, `C:\Program Files\deno\deno.exe`).
- `deno.codeLens.implementations`: Enables or disables the display of code lens
information for implementations for items in the code. _boolean, default
`false`_
- `deno.codeLens.references`: Enables or disables the display of code lens
information for references of items in the code. _boolean, default `false`_
- `deno.codeLens.referencesAllFunctions`: Enables or disables the display of
code lens information for all functions in the code. Requires
`deno.codeLens.references` to be enabled as well. _boolean, default `false`_
- `deno.codeLens.test`: Enables or disables the display of test code lens on
Deno tests. _boolean, default `false`_. _This feature is deprecated, see
`deno.testing` below_
- `deno.codeLens.testArgs`: Provides additional arguments that should be set
when invoking the Deno CLI test from a code lens. _array of strings, default
`[ "--allow-all" ]`_.
- `deno.config`: The file path to a configuration file. This is the equivalent
to using `--config` on the command line. The path can be either be relative to
the workspace, or an absolute path. It is recommended you name this file
either `deno.json` or `deno.jsonc`. _string, default `null`, examples:
`./deno.jsonc`, `/path/to/deno.jsonc`, `C:\path\to\deno.jsonc`_
- `deno.importMap`: The file path to an import map. This is the equivalent to
using `--import-map` on the command line.
[Import maps](https://deno.land/manual/linking_to_external_code/import_maps)
provide a way to "relocate" modules based on their specifiers. The path can
either be relative to the workspace, or an absolute path. _string, default
`null`, examples: `./import_map.json`, `/path/to/import_map.json`,
`C:\path\to\import_map.json`_
- `deno.internalDebug`: If enabled the Deno Language Server will log additional
internal diagnostic information.
- `deno.lint`: Controls if linting information will be provided by the Deno
Language Server. _boolean, default `true`_
- `deno.suggest.imports.hosts`: A map of domain hosts (origins) that are used
for suggesting import auto completions. (See:
[ImportCompletions](./docs/ImportCompletions.md) for more information.)
- `deno.testing.args`: Arguments to use when running tests via the Test
Explorer. Defaults to `[ \"--allow-all\" ]`.
- `deno.testing.enable`: Enable the testing API for the language server. When
folder is Deno enabled, tests will be available in the Test Explorer view.
Defaults to `true`.
- `deno.unstable`: Controls if code will be type checked with Deno's unstable
APIs. This is the equivalent to using `--unstable` on the command line.
_boolean, default `false`_
## Contribute
We appreciate your help!
To build the extension locally, clone this repository and run the following
steps:
1. Open this folder in VS Code.
2. Run `npm i`.
3. Run `npm run compile`.
4. Run the `Launch Client` launch task from the VSCode debug menu.
Most changes and feature enhancements do not require changes to the extension
though, as most information comes from the Deno Language Server itself, which is
integrated into the Deno CLI. Please check out the
[contribution guidelines](https://github.com/denoland/deno/tree/master/docs/contributing)
for the Deno CLI.
## Thanks
This project was inspired by
[justjavac/vscode-deno](https://github.com/justjavac/vscode-deno) and
[axetroy/vscode-deno](https://github.com/axetroy/vscode-deno). Thanks for their
contributions.
## License
The [MIT License](LICENSE)