Skip to content

Commit

Permalink
fix: can not close dts (#16)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
  • Loading branch information
ShenQingchuan and antfu authored Jan 11, 2024
1 parent b9c1217 commit 29412a3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ignore-workspace-root-check=true
shell-emulator=true
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
}
},
"scripts": {
"build": "tsup src/index.ts --external vscode",
"dev": "nr build --watch",
"build": "NODE_ENV=production tsup src/index.ts --external vscode",
"dev": "NODE_ENV=dev nr build --watch",
"lint": "eslint .",
"vscode:prepublish": "nr build",
"publish": "vsce publish --no-dependencies",
Expand Down
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ export function activate() {
await commands.executeCommand('editor.action.goToDeclaration')
}

const tab = window.tabGroups.activeTabGroup.activeTab
const { activeTab } = window.tabGroups.activeTabGroup
const isNeedCloseDts = workspace.getConfiguration(`${extName}`).get('closeDts')
if (isNeedCloseDts && tab && tab !== window.tabGroups.activeTabGroup.activeTab)
await window.tabGroups.close(tab)
if (isNeedCloseDts && activeTab?.label.endsWith('.d.ts'))
await window.tabGroups.close(activeTab)
}

await fn()
Expand Down
2 changes: 2 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import process from 'node:process'
import { defineConfig } from 'tsup'

export default defineConfig({
Expand All @@ -7,6 +8,7 @@ export default defineConfig({
format: ['cjs'],
shims: false,
dts: false,
sourcemap: process.env.NODE_ENV === 'development',
external: [
'vscode',
],
Expand Down

0 comments on commit 29412a3

Please sign in to comment.