Skip to content

Commit

Permalink
fix(defineConfigObject): VSCode config object cannot be reactive
Browse files Browse the repository at this point in the history
  • Loading branch information
KermanX committed Nov 17, 2024
1 parent d760508 commit dd99988
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/core/src/utils/defineConfigObject.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { UnwrapNestedRefs } from '@reactive-vscode/reactivity'
import type { ConfigurationScope, ConfigurationTarget } from 'vscode'
import type { ConfigTypeOptions, ParseConfigTypeOptions } from './defineConfigs'
import type { Nullable } from './types'
import { reactive, type UnwrapNestedRefs } from '@reactive-vscode/reactivity'
import { shallowReactive } from '@reactive-vscode/reactivity'
import { defineConfigs } from './defineConfigs'

export type ConfigObject<C extends object> = UnwrapNestedRefs<C> & {
Expand Down Expand Up @@ -31,7 +32,7 @@ export function defineConfigObject(section: Nullable<string>, configs: Record<st
const configRefs = defineConfigs(section, configs, scope)

const nestedKeys: any = {}
const rawData: any = reactive({
const rawData: any = shallowReactive({
$update(key: string, value: any, configurationTarget: any, overrideInLanguage: any) {
return configRefs[key].update(value, configurationTarget, overrideInLanguage)
},
Expand All @@ -51,7 +52,7 @@ export function defineConfigObject(section: Nullable<string>, configs: Record<st
targetData = targetData[p]
}
else {
const innerData = {}
const innerData = shallowReactive({})
Object.defineProperty(targetData, p, {
enumerable: true,
get() {
Expand Down

0 comments on commit dd99988

Please sign in to comment.