Skip to content

Commit

Permalink
Merge pull request #40 from selemondev/refactor/commands
Browse files Browse the repository at this point in the history
refactor: commands
  • Loading branch information
selemondev authored Oct 31, 2024
2 parents 87eb1db + cd2604f commit a8f8888
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ All notable changes to the "vscode-shadcn-svelte" extension will be documented i

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## v0.1.11

[compare changes](https://github.com/selemondev/vscode-shadcn-svelte/compare/v0.1.10...v0.1.11)

### 🏡 Chore

- Refactor contributes ([cb67018](https://github.com/selemondev/vscode-shadcn-svelte/commit/cb67018))

### ❤️ Contributors

- Selemondev <[email protected]>

## v0.1.10

[compare changes](https://github.com/selemondev/vscode-shadcn-svelte/compare/v0.1.9...v0.1.10)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vscode-shadcn-svelte",
"version": "0.1.10",
"version": "0.1.11",
"displayName": "shadcn/svelte",
"description": "Integrate components and snippets from Shadcn/Svelte directly into your IDE ✨.",
"publisher": "Selemondev",
Expand Down
20 changes: 6 additions & 14 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,15 @@ const commands = {
gotoDoc: "shadcn-svelte.gotoDoc",
} as const;


// Update the snippets to support Svelte version 5

export async function activate(context: vscode.ExtensionContext) {
if (!vscode.workspace.workspaceFolders || vscode.workspace.workspaceFolders.length === 0) {
vscode.window.showErrorMessage("No workspace folder open.");
return;
}

let registryData: Components;

const disposables: vscode.Disposable[] = [
vscode.commands.registerCommand(commands.initCli, async () => {
vscode.commands.registerCommand("shadcn-svelte.initCli", async () => {
const intCmd = await getInitCmd();
executeCommand(intCmd);
}),
vscode.commands.registerCommand(commands.addNewComponent, async () => {
vscode.commands.registerCommand("shadcn-svelte.addNewComponent", async () => {
registryData = [];
const newRegistryData = await getRegistry();

Expand All @@ -57,7 +49,7 @@ export async function activate(context: vscode.ExtensionContext) {
executeCommand(installCmd);
}),

vscode.commands.registerCommand(commands.addMultipleComponents, async () => {
vscode.commands.registerCommand("shadcn-svelte.addMultipleComponents", async () => {
registryData = [];
const newRegistryData = await getRegistry();

Expand All @@ -82,7 +74,7 @@ export async function activate(context: vscode.ExtensionContext) {
const installCmd = await getInstallCmd(selectedComponent);
executeCommand(installCmd);
}),
vscode.commands.registerCommand(commands.gotoComponentDoc, async () => {
vscode.commands.registerCommand("shadcn-svelte.gotoComponentDoc", async () => {
registryData = [];
const newRegistryData = await getRegistry();

Expand All @@ -104,7 +96,7 @@ export async function activate(context: vscode.ExtensionContext) {
const componentDocLink = await getComponentDocLink(selectedComponent.label);
vscode.env.openExternal(vscode.Uri.parse(componentDocLink));
}),
vscode.commands.registerCommand(commands.reloadComponentList, async () => {
vscode.commands.registerCommand("shadcn-svelte.reloadComponentList", async () => {
registryData = [];
const newRegistryData = await getRegistry();

Expand All @@ -116,7 +108,7 @@ export async function activate(context: vscode.ExtensionContext) {
registryData = newRegistryData;
vscode.window.showInformationMessage("shadcn/svelte: Reloaded components");
}),
vscode.commands.registerCommand(commands.gotoDoc, async () => {
vscode.commands.registerCommand("shadcn-svelte.gotoDoc", async () => {
const svelteVersion = await getSvelteVersion();
const shadCnDocUrl = svelteVersion >= 5 ? "https://next.shadcn-svelte.com/docs" : "https://shadcn-svelte.com/docs";
vscode.env.openExternal(vscode.Uri.parse(shadCnDocUrl));
Expand Down

0 comments on commit a8f8888

Please sign in to comment.