Skip to content

Commit 30faee6

Browse files
committed
feat!: migrate to @vue/reactivity with ported watch API
1 parent 035aac6 commit 30faee6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+888
-172
lines changed

README.md

+2

docs/guide/why.md

+1-3

eslint.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import antfu from '@antfu/eslint-config'
33

44
export default antfu(
55
{
6+
ignores: [
7+
'packages/core/src/reactivity/**/*.ts',
8+
],
69
},
710
{
811
files: ['**/*.ts'],

packages/core/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@
4242
"@types/vscode": "^1.89.0"
4343
},
4444
"dependencies": {
45-
"@vue/runtime-core": "^3.4.27"
45+
"@vue/reactivity": "^3.4.27",
46+
"@vue/shared": "^3.4.27"
4647
},
4748
"devDependencies": {
49+
"@types/node": "^20.14.2",
4850
"@types/vscode": "^1.89.0",
4951
"mkdist": "^1.5.1",
5052
"typescript": "^5.4.5"

packages/core/shim.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export {}
2+
declare global {
3+
const __DEV__: boolean
4+
}

packages/core/src/composables/useAbsolutePath.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { ComputedRef, MaybeRefOrGetter } from '@vue/runtime-core'
2-
import { computed, toValue } from '@vue/runtime-core'
1+
import type { ComputedRef, MaybeRefOrGetter } from '../reactivity'
2+
import { computed, toValue } from '../reactivity'
33
import { extensionContext } from '../utils'
44

55
/**

packages/core/src/composables/useActiveColorTheme.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { shallowRef } from '@vue/runtime-core'
21
import { window } from 'vscode'
2+
import { shallowRef } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useDisposable } from './useDisposable'
55

packages/core/src/composables/useActiveDebugSession.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import { debug } from 'vscode'
2+
import { computed, shallowRef } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useDisposable } from './useDisposable'
55

packages/core/src/composables/useActiveEditorDecorations.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { MaybeRefOrGetter } from '@vue/runtime-core'
21
import type { DecorationOptions, DecorationRenderOptions, Range, TextEditorDecorationType } from 'vscode'
2+
import type { MaybeRefOrGetter } from '../reactivity'
33
import { useActiveTextEditor } from './useActiveTextEditor'
44
import { useEditorDecorations } from './useEditorDecorations'
55

packages/core/src/composables/useActiveNotebookEditor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { shallowRef } from '@vue/runtime-core'
21
import { window } from 'vscode'
2+
import { shallowRef } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useDisposable } from './useDisposable'
55

packages/core/src/composables/useActiveTerminal.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { shallowRef } from '@vue/runtime-core'
21
import { window } from 'vscode'
2+
import { shallowRef } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useDisposable } from './useDisposable'
55

packages/core/src/composables/useActiveTextEditor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { shallowRef } from '@vue/runtime-core'
21
import { window } from 'vscode'
2+
import { shallowRef } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useDisposable } from './useDisposable'
55

packages/core/src/composables/useAllExtensions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import { extensions } from 'vscode'
2+
import { computed, shallowRef } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useDisposable } from './useDisposable'
55

packages/core/src/composables/useDefaultShell.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import { env } from 'vscode'
2+
import { computed, shallowRef } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useDisposable } from './useDisposable'
55

packages/core/src/composables/useDisposable.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { getCurrentScope } from '@vue/runtime-core'
21
import type { Disposable } from 'vscode'
2+
import { getCurrentScope } from '../reactivity'
33
import { extensionScope } from '../utils'
44

55
/**

packages/core/src/composables/useDocumentText.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { MaybeRefOrGetter } from '@vue/runtime-core'
2-
import { shallowRef, toValue, watchEffect } from '@vue/runtime-core'
31
import type { TextDocument } from 'vscode'
42
import { workspace } from 'vscode'
3+
import type { MaybeRefOrGetter } from '../reactivity'
4+
import { shallowRef, toValue, watchEffect } from '../reactivity'
55
import { useDisposable } from './useDisposable'
66

77
/**

packages/core/src/composables/useEditorDecorations.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { MaybeRefOrGetter } from '@vue/runtime-core'
2-
import { toValue, watchEffect } from '@vue/runtime-core'
31
import type { DecorationOptions, DecorationRenderOptions, Range, TextEditor, TextEditorDecorationType } from 'vscode'
42
import { window } from 'vscode'
3+
import type { MaybeRefOrGetter } from '../reactivity'
4+
import { toValue, watchEffect } from '../reactivity'
55
import type { Nullable } from '../utils/types'
66

77
/**

packages/core/src/composables/useFetchTasks.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { MaybeRefOrGetter } from '@vue/runtime-core'
2-
import { computed, toValue } from '@vue/runtime-core'
31
import type { TaskFilter } from 'vscode'
42
import { tasks } from 'vscode'
3+
import type { MaybeRefOrGetter } from '../reactivity'
4+
import { computed, toValue } from '../reactivity'
55

66
/**
77
* @reactive `tasks.fetchTasks`

packages/core/src/composables/useFileUri.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { MaybeRefOrGetter } from '@vue/runtime-core'
2-
import { toValue } from '@vue/runtime-core'
31
import { Uri } from 'vscode'
2+
import type { MaybeRefOrGetter } from '../reactivity'
3+
import { toValue } from '../reactivity'
44
import { useUri } from './useUri'
55

66
/**

packages/core/src/composables/useFoldingRangeProvider.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { MaybeRefOrGetter } from '@vue/runtime-core'
2-
import { shallowRef, toValue, watchEffect } from '@vue/runtime-core'
31
import type { DocumentSelector, FoldingRangeProvider } from 'vscode'
42
import { EventEmitter, languages } from 'vscode'
3+
import type { MaybeRefOrGetter } from '../reactivity'
4+
import { shallowRef, toValue, watchEffect } from '../reactivity'
55
import { useDisposable } from './useDisposable'
66

77
/**

packages/core/src/composables/useIsDarkTheme.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { computed } from '@vue/runtime-core'
21
import { ColorThemeKind } from 'vscode'
2+
import { computed } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useActiveColorTheme } from './useActiveColorTheme'
55

packages/core/src/composables/useIsTelemetryEnabled.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import { env } from 'vscode'
2+
import { computed, shallowRef } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useDisposable } from './useDisposable'
55

packages/core/src/composables/useL10nText.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { ComputedRef, MaybeRefOrGetter } from '@vue/runtime-core'
2-
import { computed, toRaw, toValue } from '@vue/runtime-core'
31
import { l10n } from 'vscode'
2+
import type { ComputedRef, MaybeRefOrGetter } from '../reactivity'
3+
import { computed, toRaw, toValue } from '../reactivity'
44

55
/**
66
* @reactive `l10n.t`

packages/core/src/composables/useLogLevel.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import { env } from 'vscode'
2+
import { computed, shallowRef } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useDisposable } from './useDisposable'
55

packages/core/src/composables/useNotebookEditorSelection.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import type { NotebookEditor } from 'vscode'
32
import { window } from 'vscode'
3+
import { computed, shallowRef } from '../reactivity'
44
import { createKeyedComposable } from '../utils'
55
import { useDisposable } from './useDisposable'
66

packages/core/src/composables/useNotebookEditorSelections.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import type { NotebookEditor } from 'vscode'
32
import { window } from 'vscode'
3+
import { computed, shallowRef } from '../reactivity'
44
import { createKeyedComposable } from '../utils'
55
import { useDisposable } from './useDisposable'
66

packages/core/src/composables/useNotebookEditorVisibleRanges.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import type { NotebookEditor } from 'vscode'
32
import { window } from 'vscode'
3+
import { computed, shallowRef } from '../reactivity'
44
import { createKeyedComposable } from '../utils'
55
import { useDisposable } from './useDisposable'
66

packages/core/src/composables/useOpenedTerminals.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { shallowRef } from '@vue/runtime-core'
21
import { window } from 'vscode'
2+
import { shallowRef } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useDisposable } from './useDisposable'
55

packages/core/src/composables/useStatusBarItem.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { MaybeRefOrGetter } from '@vue/runtime-core'
2-
import { toValue, watchEffect } from '@vue/runtime-core'
31
import type { StatusBarAlignment, StatusBarItem } from 'vscode'
42
import { window } from 'vscode'
3+
import type { MaybeRefOrGetter } from '../reactivity'
4+
import { toValue, watchEffect } from '../reactivity'
55
import { useDisposable } from './useDisposable'
66

77
export interface UseStatusBarItemOptions {

packages/core/src/composables/useTaskExecutions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import { tasks } from 'vscode'
2+
import { computed, shallowRef } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useDisposable } from './useDisposable'
55

packages/core/src/composables/useTerminalState.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import type { Terminal } from 'vscode'
32
import { window } from 'vscode'
3+
import { computed, shallowRef } from '../reactivity'
44
import { createKeyedComposable } from '../utils'
55
import { useDisposable } from './useDisposable'
66

packages/core/src/composables/useTextEditorSelection.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import type { TextEditor } from 'vscode'
32
import { window } from 'vscode'
3+
import { computed, shallowRef } from '../reactivity'
44
import { createKeyedComposable } from '../utils'
55
import { useDisposable } from './useDisposable'
66

packages/core/src/composables/useTextEditorSelections.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import type { TextEditor } from 'vscode'
32
import { window } from 'vscode'
3+
import { computed, shallowRef } from '../reactivity'
44
import { createKeyedComposable } from '../utils'
55
import { useDisposable } from './useDisposable'
66

packages/core/src/composables/useTextEditorViewColumn.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import type { TextEditor } from 'vscode'
32
import { window } from 'vscode'
3+
import { computed, shallowRef } from '../reactivity'
44
import { createKeyedComposable } from '../utils'
55
import { useDisposable } from './useDisposable'
66

packages/core/src/composables/useTextEditorVisibleRanges.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import type { TextEditor } from 'vscode'
32
import { window } from 'vscode'
3+
import { computed, shallowRef } from '../reactivity'
44
import { createKeyedComposable } from '../utils'
55
import { useDisposable } from './useDisposable'
66

packages/core/src/composables/useTreeView.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { MaybeRefOrGetter } from '@vue/runtime-core'
2-
import { toValue, watch } from '@vue/runtime-core'
31
import type { TreeDataProvider, TreeView, TreeViewOptions } from 'vscode'
42
import { EventEmitter, window } from 'vscode'
3+
import type { MaybeRefOrGetter } from '../reactivity'
4+
import { toValue, watch } from '../reactivity'
55
import { createKeyedComposable } from '../utils'
66
import { useDisposable } from './useDisposable'
77

packages/core/src/composables/useUri.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { MaybeRefOrGetter } from '@vue/runtime-core'
2-
import { shallowReactive, toValue } from '@vue/runtime-core'
31
import type { Uri } from 'vscode'
2+
import type { MaybeRefOrGetter } from '../reactivity'
3+
import { shallowReactive, toValue } from '../reactivity'
44

55
/**
66
* @reactive `Uri`

packages/core/src/composables/useViewBadge.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { MaybeRefOrGetter } from '@vue/runtime-core'
2-
import { toValue, watchEffect } from '@vue/runtime-core'
31
import type { TreeView, ViewBadge, WebviewView } from 'vscode'
2+
import type { MaybeRefOrGetter } from '../reactivity'
3+
import { toValue, watchEffect } from '../reactivity'
44
import type { Nullable } from '../utils/types'
55

66
type ViewWithBadge = Pick<TreeView<unknown> | WebviewView, 'badge'>

packages/core/src/composables/useViewTitle.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { MaybeRefOrGetter } from '@vue/runtime-core'
2-
import { toValue, watchEffect } from '@vue/runtime-core'
31
import type { TreeView, WebviewView } from 'vscode'
2+
import type { MaybeRefOrGetter } from '../reactivity'
3+
import { toValue, watchEffect } from '../reactivity'
44
import type { Nullable } from '../utils/types'
55

66
type ViewWithTitle = Pick<TreeView<unknown> | WebviewView, 'title'>

packages/core/src/composables/useViewVisibility.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { ComputedRef, MaybeRefOrGetter } from '@vue/runtime-core'
2-
import { computed, ref, toValue, watchEffect } from '@vue/runtime-core'
31
import type { TreeView, WebviewView } from 'vscode'
2+
import type { ComputedRef, MaybeRefOrGetter } from '../reactivity'
3+
import { computed, ref, toValue, watchEffect } from '../reactivity'
44
import type { Nullable } from '../utils/types'
55

66
type ViewWithVisibility = Pick<TreeView<unknown> | WebviewView, 'visible' | 'onDidChangeVisibility'>

packages/core/src/composables/useVisibleNotebookEditors.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { shallowRef } from '@vue/runtime-core'
21
import { window } from 'vscode'
2+
import { shallowRef } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useDisposable } from './useDisposable'
55

packages/core/src/composables/useVisibleTextEditors.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { shallowRef } from '@vue/runtime-core'
21
import { window } from 'vscode'
2+
import { shallowRef } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useDisposable } from './useDisposable'
55

packages/core/src/composables/useVscodeContext.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { ComputedRef, MaybeRefOrGetter, Ref, WritableComputedRef } from '@vue/runtime-core'
2-
import { computed, toValue, watchEffect } from '@vue/runtime-core'
31
import { commands } from 'vscode'
2+
import type { ComputedRef, MaybeRefOrGetter, Ref, WritableComputedRef } from '../reactivity'
3+
import { computed, toValue, watchEffect } from '../reactivity'
44

55
export function useVscodeContext<T>(
66
name: string,

packages/core/src/composables/useWebviewView.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { MaybeRefOrGetter } from '@vue/runtime-core'
2-
import { shallowRef, toValue, watchEffect } from '@vue/runtime-core'
31
import type { WebviewOptions, WebviewView } from 'vscode'
42
import { window } from 'vscode'
3+
import type { MaybeRefOrGetter } from '../reactivity'
4+
import { shallowRef, toValue, watchEffect } from '../reactivity'
55
import { createKeyedComposable } from '../utils'
66
import { useDisposable } from './useDisposable'
77

packages/core/src/composables/useWindowState.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import { window } from 'vscode'
2+
import { computed, shallowRef } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useDisposable } from './useDisposable'
55

packages/core/src/composables/useWorkspaceFolders.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { computed, shallowRef } from '@vue/runtime-core'
21
import { workspace } from 'vscode'
2+
import { computed, shallowRef } from '../reactivity'
33
import { createSingletonComposable } from '../utils'
44
import { useDisposable } from './useDisposable'
55

0 commit comments

Comments
 (0)