Skip to content

Commit f8b696a

Browse files
committed
refactor: move commands.openInBrowser to commands
1 parent def2044 commit f8b696a

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/commands/open-in-browser.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { NPMX_DEV } from '#constants'
2+
import { env, Uri } from 'vscode'
3+
4+
export function openInBrowser() {
5+
env.openExternal(Uri.parse(NPMX_DEV))
6+
}

src/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import {
2-
NPMX_DEV,
32
PACKAGE_JSON_BASENAME,
43
PACKAGE_JSON_PATTERN,
54
PNPM_WORKSPACE_BASENAME,
65
PNPM_WORKSPACE_PATTERN,
76
VERSION_TRIGGER_CHARACTERS,
87
} from '#constants'
98
import { defineExtension, useCommands, watchEffect } from 'reactive-vscode'
10-
import { Disposable, env, languages, Uri } from 'vscode'
9+
import { Disposable, languages } from 'vscode'
1110
import { openFileInNpmx } from './commands/open-file-in-npmx'
11+
import { openInBrowser } from './commands/open-in-browser'
1212
import { PackageJsonExtractor } from './extractors/package-json'
1313
import { PnpmWorkspaceYamlExtractor } from './extractors/pnpm-workspace-yaml'
1414
import { commands, displayName, version } from './generated-meta'
@@ -67,9 +67,7 @@ export const { activate, deactivate } = defineExtension(() => {
6767
})
6868

6969
useCommands({
70-
[commands.openInBrowser]: () => {
71-
env.openExternal(Uri.parse(NPMX_DEV))
72-
},
70+
[commands.openInBrowser]: openInBrowser,
7371
[commands.openFileInNpmx]: openFileInNpmx,
7472
})
7573
})

0 commit comments

Comments
 (0)