Skip to content

Commit

Permalink
feat: add deno.path setting (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsonk authored Mar 2, 2021
1 parent a9480d4 commit b289be3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ 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.7 or
> later) and available in your path before attempting to use this extension.
> 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.
Expand All @@ -35,9 +37,11 @@ Studio Code, powered by the Deno language server.

## Usage

1. Install the Deno CLI, available in your path.
1. Install the Deno CLI.
2. Install this extension.
3. Open the VS Code command palette with `Ctrl+Shift+P`, and run the _Deno:
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
Expand Down Expand Up @@ -88,6 +92,10 @@ extension has the following configuration options:
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`_
Expand Down
6 changes: 4 additions & 2 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,17 @@ let statusBarItem: vscode.StatusBarItem;
export async function activate(
context: vscode.ExtensionContext,
): Promise<void> {
const command =
vscode.workspace.getConfiguration("deno").get<string>("path") || "deno";
const run: Executable = {
command: "deno",
command,
args: ["lsp"],
// deno-lint-ignore no-undef
options: { env: { ...process.env, "NO_COLOR": true } },
};

const debug: Executable = {
command: "deno",
command,
// disabled for now, as this gets super chatty during development
// args: ["lsp", "-L", "debug"],
args: ["lsp"],
Expand Down
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@
false
]
},
"deno.path": {
"type": "string",
"default": null,
"markdownDescription": "A path to the `deno` CLI executable. By default, the extension looks for `deno` in the `PATH`, but if set, will use the path specified instead.",
"scope": "window",
"examples": [
"/usr/bin/deno",
"C:\\Program Files\\deno\\deno.exe"
]
},
"deno.codeLens.implementations": {
"type": "boolean",
"default": false,
Expand Down Expand Up @@ -188,4 +198,4 @@
"@types/node": "^14.14.25",
"typescript": "^4.1.3"
}
}
}

0 comments on commit b289be3

Please sign in to comment.