Consider autoscoped name when looking up dynamic config (#9916)

Fixes #9635

@JaroslavTulach with this change you reproduction scenario works as it should.


https://github.com/enso-org/enso/assets/6566674/89ecaae4-c5e5-437a-8ff2-3e77ccb0a67c
This commit is contained in:
Ilya Bogdanov 2024-05-14 14:01:19 +03:00 committed by GitHub
parent 43c80da8a3
commit 52b8ed4d3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 5 deletions

View File

@ -9,8 +9,12 @@ import { toValue } from 'vue'
// other recently-created nodes have rendered and computed their real sizes. // other recently-created nodes have rendered and computed their real sizes.
export const DEFAULT_NODE_SIZE = new Vec2(300, 32) export const DEFAULT_NODE_SIZE = new Vec2(300, 32)
const orDefaultSize = (rect: Rect) => const orDefaultSize = (rect: Rect) => {
rect.width !== 0 ? rect : new Rect(rect.pos, DEFAULT_NODE_SIZE) if (rect.width !== 0 && rect.height !== 0) return rect
const width = Math.max(rect.width, DEFAULT_NODE_SIZE.x)
const height = Math.max(rect.height, DEFAULT_NODE_SIZE.y)
return new Rect(rect.pos, new Vec2(width, height))
}
type ToValue<T> = MaybeRefOrGetter<T> | ComputedRef<T> type ToValue<T> = MaybeRefOrGetter<T> | ComputedRef<T>

View File

@ -157,8 +157,9 @@ const inheritedConfig = computed(() => {
if (props.input.dynamicConfig?.kind === 'OneOfFunctionCalls' && methodCallInfo.value != null) { if (props.input.dynamicConfig?.kind === 'OneOfFunctionCalls' && methodCallInfo.value != null) {
const cfg = props.input.dynamicConfig const cfg = props.input.dynamicConfig
const info = methodCallInfo.value const info = methodCallInfo.value
const name = entryQn(info?.suggestion) const fullName = entryQn(info?.suggestion)
return cfg.possibleFunctions.get(name) const autoscopedName = '..' + info?.suggestion.name
return cfg.possibleFunctions.get(fullName) ?? cfg.possibleFunctions.get(autoscopedName)
} }
return undefined return undefined
}) })

View File

@ -128,7 +128,7 @@ export interface FunctionCall {
export interface OneOfFunctionCalls { export interface OneOfFunctionCalls {
kind: 'OneOfFunctionCalls' kind: 'OneOfFunctionCalls'
/** A list of possible function calls and their corresponding configuration. /** A list of possible function calls and their corresponding configuration.
* The key is typically a fully qualified name of the function, but in general it can be anything, * The key is typically a fully qualified or autoscoped name of the function, but in general it can be anything,
* depending on the widget implementation. */ * depending on the widget implementation. */
possibleFunctions: Map<string, FunctionCall> possibleFunctions: Map<string, FunctionCall>
} }