Skip to content

Commit b2aba64

Browse files
committed
activate fig integration lazily
1 parent 64f9ad4 commit b2aba64

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"@vscode/emmet-helper": "^2.8.4",
7676
"@vscode/test-electron": "^2.1.5",
7777
"@zardoy/utils": "^0.0.9",
78-
"@zardoy/vscode-utils": "^0.0.39",
78+
"@zardoy/vscode-utils": "^0.0.41",
7979
"chai": "^4.3.6",
8080
"chokidar": "^3.5.3",
8181
"chokidar-cli": "^3.0.0",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/figIntegration.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import * as vscode from 'vscode'
22
import { defaultJsSupersetLangs } from '@zardoy/vscode-utils/build/langs'
33
import { getExtensionSetting } from 'vscode-framework'
4+
import { watchExtensionSettings } from '@zardoy/vscode-utils/build/settings'
45

5-
export default async () => {
6-
// todo I think would be good to support zx package $
6+
let integrationActivated = false
7+
const possiblyActivateFigIntegration = async () => {
8+
if (integrationActivated) return
9+
// eslint-disable-next-line sonarjs/no-duplicate-string
10+
if (getExtensionSetting('figIntegration.enableWhenStartsWith').length === 0) return
11+
integrationActivated = true
12+
13+
// todo I think would be good to support zx package $ but not sure if needed
714
const figExtension = vscode.extensions.getExtension('undefined_publisher.fig-unreleased')
815
if (!figExtension) return
916
const api = await figExtension.activate()
@@ -43,3 +50,10 @@ export default async () => {
4350
},
4451
)
4552
}
53+
54+
export default () => {
55+
void possiblyActivateFigIntegration()
56+
watchExtensionSettings(['figIntegration.enableWhenStartsWith'], () => {
57+
void possiblyActivateFigIntegration()
58+
})
59+
}

0 commit comments

Comments
 (0)