Add edit flow for Parameters to Feature Tree (#7536)

* Add edit flow to named parameters, show their value in feature tree

* Amend a feature tree test to include editing a parameter

* Enforce disallowing "create new variable" in edit parameter flow

* Add wrapping behavior! Sorry forgot to commit this

* Update src/machines/commandBarMachine.ts

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
This commit is contained in:
Frank Noirot
2025-06-19 11:14:37 -04:00
committed by GitHub
parent 9dd6e3e852
commit 23a01e86e6
8 changed files with 273 additions and 118 deletions

View File

@ -803,7 +803,9 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
valueSummary: (nodeToEdit: PathToNode) => {
const node = getNodeFromPath<VariableDeclarator>(
kclManager.ast,
nodeToEdit
nodeToEdit,
'VariableDeclarator',
true
)
if (err(node) || node.node.type !== 'VariableDeclarator')
return 'Error'
@ -993,16 +995,46 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
inputType: 'options',
required: true,
options: [
{ name: 'Red', value: '#FF0000' },
{ name: 'Green', value: '#00FF00' },
{ name: 'Blue', value: '#0000FF' },
{ name: 'Turquoise', value: '#00FFFF' },
{ name: 'Purple', value: '#FF00FF' },
{ name: 'Yellow', value: '#FFFF00' },
{ name: 'Black', value: '#000000' },
{ name: 'Dark Grey', value: '#080808' },
{ name: 'Light Grey', value: '#D3D3D3' },
{ name: 'White', value: '#FFFFFF' },
{
name: 'Red',
value: '#FF0000',
},
{
name: 'Green',
value: '#00FF00',
},
{
name: 'Blue',
value: '#0000FF',
},
{
name: 'Turquoise',
value: '#00FFFF',
},
{
name: 'Purple',
value: '#FF00FF',
},
{
name: 'Yellow',
value: '#FFFF00',
},
{
name: 'Black',
value: '#000000',
},
{
name: 'Dark Grey',
value: '#080808',
},
{
name: 'Light Grey',
value: '#D3D3D3',
},
{
name: 'White',
value: '#FFFFFF',
},
{
name: 'Default (clear appearance)',
value: COMMAND_APPEARANCE_COLOR_DEFAULT,
@ -1124,7 +1156,11 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
KCL_DEFAULT_CONSTANT_PREFIXES.CLONE
)
},
validation: async ({ data }: { data: string }) => {
validation: async ({
data,
}: {
data: string
}) => {
// Be conservative and error out if there is an item or module with the same name.
const variableExists =
kclManager.variables[data] || kclManager.variables['__mod_' + data]