Fix: Center rectangle now works again, works with new LiteralValue structure (#5172)
* fix: new Literal data structure update * fix: updated the LiteralValue dereferencing and added some type narrowing helpers * fix: updating formatting * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * fix: implementing a safer dereference method until we update createLiteraly() * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * why is this fallback here * fix: updating the type narrowing function * fix: restore this... see if snapshots trigger again * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * bump * bump * Add number with units formatting as KCL (#5195) * Add number with units formatting as KCL * Change type assertion helper to check what we need * Fix rectangle unit test * fix: adding a wait for execution to prevent clicking before lines are rendered --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
This commit is contained in:
@ -2,6 +2,7 @@ import {
|
||||
init,
|
||||
parse_wasm,
|
||||
recast_wasm,
|
||||
format_number,
|
||||
execute,
|
||||
kcl_lint,
|
||||
modify_ast_for_sketch_wasm,
|
||||
@ -54,6 +55,7 @@ import { ArtifactCommand } from 'wasm-lib/kcl/bindings/Artifact'
|
||||
import { ArtifactGraph as RustArtifactGraph } from 'wasm-lib/kcl/bindings/Artifact'
|
||||
import { Artifact } from './std/artifactGraph'
|
||||
import { getNodePathFromSourceRange } from 'lang/queryAstNodePathUtils'
|
||||
import { NumericSuffix } from 'wasm-lib/kcl/bindings/NumericSuffix'
|
||||
|
||||
export type { Artifact } from 'wasm-lib/kcl/bindings/Artifact'
|
||||
export type { ArtifactCommand } from 'wasm-lib/kcl/bindings/Artifact'
|
||||
@ -90,6 +92,7 @@ export type { Literal } from '../wasm-lib/kcl/bindings/Literal'
|
||||
export type { LiteralValue } from '../wasm-lib/kcl/bindings/LiteralValue'
|
||||
export type { ArrayExpression } from '../wasm-lib/kcl/bindings/ArrayExpression'
|
||||
export type { SourceRange } from 'wasm-lib/kcl/bindings/SourceRange'
|
||||
export type { NumericSuffix } from 'wasm-lib/kcl/bindings/NumericSuffix'
|
||||
|
||||
export type SyntaxType =
|
||||
| 'Program'
|
||||
@ -638,6 +641,13 @@ export const recast = (ast: Program): string | Error => {
|
||||
return recast_wasm(JSON.stringify(ast))
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a number with suffix as KCL.
|
||||
*/
|
||||
export function formatNumber(value: number, suffix: NumericSuffix): string {
|
||||
return format_number(value, JSON.stringify(suffix))
|
||||
}
|
||||
|
||||
export const makeDefaultPlanes = async (
|
||||
engineCommandManager: EngineCommandManager
|
||||
): Promise<DefaultPlanes> => {
|
||||
|
||||
Reference in New Issue
Block a user