Skip to content

Commit

Permalink
feat: remove init workspace command (#1027)
Browse files Browse the repository at this point in the history
  • Loading branch information
nayeemrmn authored Jan 15, 2024
1 parent 43a135e commit edde9c6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 110 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Studio Code, powered by the Deno language server.
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.
Enable_ 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
Expand All @@ -70,9 +70,9 @@ The extension provides several commands:
> 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: Enable_ - will enabled Deno on the current workspace. Alternatively
you can create a `deno.json` or `deno.jsonc` file at the root of your
workspace.
- _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.
Expand Down Expand Up @@ -215,8 +215,9 @@ extension has the following configuration options:
[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.unstable`: Controls if code will be type checked with Deno's unstable
APIs. This is the equivalent to using `--unstable` on the command line.
- `deno.unstable`: Controls if code will be executed with Deno's unstable APIs.
Affects execution which is triggered through the extension, such as test code
lenses. This is the equivalent to using `--unstable` on the command line.
_boolean, default `false`_

## Compatibility
Expand Down
32 changes: 0 additions & 32 deletions client/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
LANGUAGE_CLIENT_NAME,
SERVER_SEMVER,
} from "./constants";
import { pickInitWorkspace } from "./initialize_project";
import {
cache as cacheReq,
reloadImportRegistries as reloadImportRegistriesReq,
Expand Down Expand Up @@ -98,37 +97,6 @@ export function cacheActiveDocument(
};
}

export function initializeWorkspace(
_context: vscode.ExtensionContext,
_extensionContext: DenoExtensionContext,
): Callback {
return async () => {
try {
const settings = await pickInitWorkspace();
const config = vscode.workspace.getConfiguration(EXTENSION_NS);
await config.update("enable", true);

const lintInspect = config.inspect("lint");
assert(lintInspect);
const unstableInspect = config.inspect("unstable");
assert(unstableInspect);

await config.update("lint", settings.lint);
await config.update("unstable", settings.unstable);

await vscode.window.showInformationMessage(
"Deno is now setup in this workspace.",
);
} catch (error) {
vscode.window.showErrorMessage(
`Deno project initialization failed: ${
(error as Error).message ?? error
}`,
);
}
};
}

export function reloadImportRegistries(
_context: vscode.ExtensionContext,
extensionContext: DenoExtensionContext,
Expand Down
4 changes: 0 additions & 4 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,6 @@ export async function activate(
"deno.client.cacheActiveDocument",
commands.cacheActiveDocument,
);
registerCommand(
"deno.client.initializeWorkspace",
commands.initializeWorkspace,
);
registerCommand("deno.client.restart", commands.startLanguageServer);
registerCommand("deno.client.info", commands.info);
registerCommand("deno.client.status", commands.status);
Expand Down
56 changes: 0 additions & 56 deletions client/src/initialize_project.ts

This file was deleted.

11 changes: 6 additions & 5 deletions client/src/welcome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export class WelcomePanel {
);
return;
}
case "init": {
vscode.commands.executeCommand("deno.client.initializeWorkspace");
case "enable": {
vscode.commands.executeCommand("deno.client.enable");
return;
}
}
Expand Down Expand Up @@ -123,9 +123,10 @@ export class WelcomePanel {
<p class="Card-content">
<p>
The extension does not assume it applies to all workspaces you use
with VSCode. You can enable Deno in a workspace by running the
<em><a href="#" class="Command" data-command="init">Deno:
Initialize Workspace Configuration</a></em> command.
with VSCode. You can enable Deno in a workspace by creating a
<code>deno.json</code> or <code>deno.jsonc</code> at the root, or
by running the <em><a href="#" class="Command"
data-command="enable"> Deno: Enable</a></em> command.
</p>
<p>
You can also enable or disable it in the
Expand Down
7 changes: 0 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"onDebugResolve:javascript",
"onDebugResolve:javascriptreact",
"onCommand:deno.client.welcome",
"onCommand:deno.client.initializeWorkspace",
"onCommand:deno.client.enable",
"onCommand:deno.client.disable",
"onCommand:deno.reloadImportRegistries",
Expand Down Expand Up @@ -88,12 +87,6 @@
"description": "Cache the active workspace document and its dependencies.",
"enablement": "deno:lspReady"
},
{
"command": "deno.client.initializeWorkspace",
"title": "Initialize Workspace Configuration",
"category": "Deno",
"description": "Initialize the workspace configuration for Deno."
},
{
"command": "deno.reloadImportRegistries",
"title": "Reload Import Registries Cache",
Expand Down

0 comments on commit edde9c6

Please sign in to comment.