Skip to content

Commit

Permalink
fix: watchFs error (#6)
Browse files Browse the repository at this point in the history
* fix: watchFs error

* chore: release v0.3.4
  • Loading branch information
lizyChy0329 authored Nov 25, 2024
1 parent 84f75ad commit 3bfc7e1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "copy-image-size",
"displayName": "Copy Image Size",
"type": "module",
"version": "0.3.3",
"version": "0.3.4",
"private": false,
"packageManager": "[email protected]",
"description": "Copy Image Size for Tailwind or Unocss or CSS",
Expand Down Expand Up @@ -182,7 +182,7 @@
"image-size": "^1.1.1",
"jest-mock-vscode": "^4.0.2",
"lint-staged": "^15.2.10",
"reactive-vscode": "^0.2.8",
"reactive-vscode": "^0.2.9",
"simple-git-hooks": "^2.11.1",
"tsup": "^8.3.5",
"typescript": "^5.6.3",
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

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

14 changes: 8 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,19 @@ const { activate, deactivate } = defineExtension(() => {
watchEffect(async () => {
if (view.value) {
vscode2Webview('initImages', urix, view)

// focus to Activitybar pinecone icon
commands.executeCommand("1_pineconeViews.focus", {
preserveFocus: true
})
}

// focus to Activitybar pinecone icon
commands.executeCommand("1_pineconeViews.focus", {
preserveFocus: true
})
})

// register fs watcher
const readyToUpdate = ref(false);
const globs = reactive(new Set([`**/${currentAssetsPath.replace(/\\/g, '/').slice(1)}/*`]))
const watcher = createSingletonComposable(() => useFsWatcher(globs))

watcher().onDidCreate(() => {
readyToUpdate.value = true
})
Expand All @@ -68,7 +69,7 @@ const { activate, deactivate } = defineExtension(() => {
readyToUpdate.value = true
})

watch(readyToUpdate, async (newVal) => {
watch(readyToUpdate, (newVal) => {
if (newVal) {
setTimeout(async () => {
vscode2Webview('updateImages', urix, view)
Expand All @@ -77,6 +78,7 @@ const { activate, deactivate } = defineExtension(() => {
readyToUpdate.value = false
}
})

})

/**
Expand Down
2 changes: 1 addition & 1 deletion views/src/components/SearchBarPortrait.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const imageSizeVModel = defineModel('imageSize')
</script>

<template>
<div my-3 flex px-2 space-x-2>
<div my-3 flex space-x-2>
<div flex-1>
<input v-model="searchVModel" type="text" placeholder="我是输入框" class="w-full rounded-1 bg-gray-100 bg-gray-300 px-2 py-1 text-gray-600">
</div>
Expand Down

0 comments on commit 3bfc7e1

Please sign in to comment.