Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: watchFs error #6

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": "pnpm@8.15.7",
"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