Skip to content

Commit

Permalink
Review.
Browse files Browse the repository at this point in the history
  • Loading branch information
kazcw committed Feb 23, 2024
1 parent ddb3609 commit 738111a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/gui2/src/components/ComponentBrowser/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
} from '@/util/qualifiedName'
import { equalFlat } from 'lib0/array'
import { sourceRangeKey, type SourceRange } from 'shared/yjsModel'
import { computed, nextTick, ref, watch, type ComputedRef } from 'vue'
import { computed, nextTick, ref, type ComputedRef } from 'vue'

/** Information how the component browser is used, needed for proper input initializing. */
export type Usage =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ import NodeWidget from '@/components/GraphEditor/NodeWidget.vue'
import { injectPortInfo } from '@/providers/portInfo'
import { Score, WidgetInput, defineWidget, widgetProps } from '@/providers/widgetRegistry'
import { Ast } from '@/util/ast'
import {
ApplicationKind,
ArgumentInfoKey,
ArgumentNameShownKey,
ArgumentPlaceholder,
} from '@/util/callTree'
import { ApplicationKind, ArgumentInfoKey, ArgumentPlaceholder } from '@/util/callTree'
import type { SuggestionEntryArgument } from 'shared/languageServerTypes/suggestions'
import { computed } from 'vue'
Expand All @@ -29,7 +24,7 @@ const primary = computed(() => props.nesting < 2)
const innerInput = computed(() => ({
...props.input,
[ArgumentInfoKey]: { ...props.input[ArgumentInfoKey], [ArgumentNameShownKey]: true },
[ArgumentNameShownKey]: true,
}))
</script>

Expand All @@ -50,6 +45,8 @@ export const widgetDefinition = defineWidget(hasKnownArgumentName, {
return isPlaceholder || isTopArg ? Score.Perfect : Score.Mismatch
},
})
export const ArgumentNameShownKey: unique symbol = Symbol('ArgumentNameShownKey')
</script>

<template>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { ArgumentNameShownKey } from '@/components/GraphEditor/widgets/WidgetArgumentName.vue'
import CheckboxWidget from '@/components/widgets/CheckboxWidget.vue'
import { Score, WidgetInput, defineWidget, widgetProps } from '@/providers/widgetRegistry'
import { useGraphStore } from '@/stores/graph'
Expand All @@ -7,7 +8,7 @@ import { useSuggestionDbStore } from '@/stores/suggestionDatabase'
import { assert } from '@/util/assert'
import { Ast } from '@/util/ast'
import type { TokenId } from '@/util/ast/abstract'
import { ArgumentInfoKey, ArgumentNameShownKey } from '@/util/callTree'
import { ArgumentInfoKey } from '@/util/callTree'
import { asNot } from '@/util/data/types.ts'
import { type Identifier, type QualifiedName } from '@/util/qualifiedName'
import { computed } from 'vue'
Expand Down Expand Up @@ -59,9 +60,8 @@ const value = computed({
const primary = computed(() => props.nesting < 2)
const argumentName = computed(() => {
if (props.input[ArgumentInfoKey]?.info == null) return
if (props.input[ArgumentInfoKey][ArgumentNameShownKey]) return
return props.input[ArgumentInfoKey].info.name
if (ArgumentNameShownKey in props.input) return
return props.input[ArgumentInfoKey]?.info?.name
})
</script>

Expand Down
2 changes: 0 additions & 2 deletions app/gui2/src/util/callTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,14 +388,12 @@ export function getAccessOprSubject(app: Ast.Ast): Ast.Ast | undefined {

export const ArgumentApplicationKey: unique symbol = Symbol('ArgumentApplicationKey')
export const ArgumentInfoKey: unique symbol = Symbol('ArgumentInfoKey')
export const ArgumentNameShownKey: unique symbol = Symbol('ArgumentNameShownKey')
declare module '@/providers/widgetRegistry' {
export interface WidgetInput {
[ArgumentApplicationKey]?: ArgumentApplication
[ArgumentInfoKey]?: {
appKind: ApplicationKind
info: SuggestionEntryArgument | undefined
[ArgumentNameShownKey]?: boolean
}
}
}

0 comments on commit 738111a

Please sign in to comment.