Add ability to create named constant without code (#5840)
* Add support for forcing kcl input create variable * Command palette padding tweak * Make traverse function work for ExpressionStatements * Add utilities for getting earliest safe index in AST * Fix the insertIndex logic to not be based on the selection anymore * Add workflow to create a named constant * Fix bug with nameEndInDigits matcher * Tweak command config * Add a three-dot menu to feature tree pane to create parameters * Add E2E test for create parameter flow * Remove edit flow oops * Fix tsc error * Fix E2E test * Update named constant position in edit flow test * Add tags into consideration for safe insert index Per @Irev-dev's helpful feedback, with unit tests!
This commit is contained in:
@ -223,8 +223,8 @@ export function findUniqueName(
|
||||
if (!nameIsInString) return name
|
||||
|
||||
// recursive case: name is not unique and ends in digits
|
||||
const newPad = nameEndsInDigits[1].length
|
||||
const newIndex = parseInt(nameEndsInDigits[1]) + 1
|
||||
const newPad = nameEndsInDigits[0].length
|
||||
const newIndex = parseInt(nameEndsInDigits[0]) + 1
|
||||
const nameWithoutDigits = name.replace(endingDigitsMatcher, '')
|
||||
|
||||
return findUniqueName(searchStr, nameWithoutDigits, newPad, newIndex)
|
||||
|
Reference in New Issue
Block a user