Compare commits

...

18 Commits

Author SHA1 Message Date
5bea90ad9a add API fallback for engine utils lib 2024-10-22 12:58:35 -07:00
d23ddc19eb Merge branch 'main' into mike/engine-utils-wasm 2024-10-22 10:27:12 -07:00
4bd7e02271 Support negative start and end in ranges (#4249)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2024-10-22 14:28:48 +13:00
26042790b6 Remove setInterval implementations from camera controls (#4255)
* remove setInterval implementations from camera controls

* fmt
2024-10-21 16:46:47 -07:00
af74f3bb05 Upgrade to rust toolchain 1.82.0 (#4245)
* Upgrade to rust toolchain 1.82.0

* Fix lint about variant being too large

* Fix lint about Err variant being too large
2024-10-21 16:35:04 -05:00
0bdedf5854 fix job name for printers (#4234)
Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Paul Tagliamonte <paul@zoo.dev>
2024-10-21 21:27:32 +00:00
d2c6b5cf3a Buffer file writes, because writing to file after every keypress has bad consequences (#4242)
* Buffer file writes, because writing to file after every keypress does bad things

* fix: kevin -- added timeouts for the time being since the workflow for saving data to disk is now changed

---------

Co-authored-by: Kevin Nadro <kevin@zoo.dev>
2024-10-21 15:07:20 -05:00
e65358f635 add needed tangential arc params to the serializable path 2024-10-11 11:11:27 -07:00
0a1201e680 cleanup 2024-10-11 10:55:55 -07:00
9db013e672 fmt 2024-10-11 10:47:17 -07:00
0196d72a2d mini code cleanup 2024-10-11 10:44:46 -07:00
e6af4078bd actual working arcs using engine utils 2024-10-10 18:19:26 -07:00
2b233dc705 it works! 2024-10-10 16:58:12 -07:00
b11e8af9c7 _ 2024-10-10 11:52:33 -07:00
c017847d7b Fix to convert JS Promise to async Rust 2024-10-09 00:09:19 -04:00
9635eea8c1 walking away 2024-10-08 13:15:24 -07:00
5a2df642b1 thrashing 2024-10-08 12:00:34 -07:00
621e41080e delme 2024-10-07 11:36:33 -07:00
33 changed files with 465 additions and 110 deletions

BIN
..env.development.local.swp Normal file

Binary file not shown.

View File

@ -1,3 +1,4 @@
src/wasm-lib/* src/wasm-lib/*
src/lib/engine-utils/engine.js
*.typegen.ts *.typegen.ts
packages/codemirror-lsp-client/dist/* packages/codemirror-lsp-client/dist/*

4
.gitignore vendored
View File

@ -66,3 +66,7 @@ venv
# electron # electron
out/ out/
# engine wasm utils
src/lib/engine-utils/engine.wasm
src/lib/engine-utils/engine.js

View File

@ -136,6 +136,9 @@ test.describe('when using the file tree to', () => {
) )
await pasteCodeInEditor(kclCube) await pasteCodeInEditor(kclCube)
// TODO: We have a timeout of 1s between edits to write to disk. If you reload the page too quickly it won't write to disk.
await tronApp.page.waitForTimeout(2000)
await renameFile(fromFile, toFile) await renameFile(fromFile, toFile)
await tronApp.page.reload() await tronApp.page.reload()
@ -222,9 +225,11 @@ test.describe('when using the file tree to', () => {
) )
await pasteCodeInEditor(kclCube) await pasteCodeInEditor(kclCube)
// TODO: We have a timeout of 1s between edits to write to disk. If you reload the page too quickly it won't write to disk.
await tronApp.page.waitForTimeout(2000)
const kcl1 = 'main.kcl' const kcl1 = 'main.kcl'
const kcl2 = '2.kcl' const kcl2 = '2.kcl'
await createNewFileAndSelect(kcl2) await createNewFileAndSelect(kcl2)
const kclCylinder = await fsp.readFile( const kclCylinder = await fsp.readFile(
'src/wasm-lib/tests/executor/inputs/cylinder.kcl', 'src/wasm-lib/tests/executor/inputs/cylinder.kcl',
@ -232,6 +237,9 @@ test.describe('when using the file tree to', () => {
) )
await pasteCodeInEditor(kclCylinder) await pasteCodeInEditor(kclCylinder)
// TODO: We have a timeout of 1s between edits to write to disk. If you reload the page too quickly it won't write to disk.
await tronApp.page.waitForTimeout(2000)
await renameFile(kcl2, kcl1) await renameFile(kcl2, kcl1)
await test.step(`Postcondition: ${kcl1} still has the original content`, async () => { await test.step(`Postcondition: ${kcl1} still has the original content`, async () => {

View File

@ -64,6 +64,27 @@ export type ReactCameraProperties =
const lastCmdDelay = 50 const lastCmdDelay = 50
class CameraRateLimiter {
lastSend?: Date = undefined
rateLimitMs: number = 16 //60 FPS
send = (f: () => void) => {
let now = new Date()
if (
this.lastSend === undefined ||
now.getTime() - this.lastSend.getTime() > this.rateLimitMs
) {
f()
this.lastSend = now
}
}
reset = () => {
this.lastSend = undefined
}
}
export class CameraControls { export class CameraControls {
engineCommandManager: EngineCommandManager engineCommandManager: EngineCommandManager
syncDirection: 'clientToEngine' | 'engineToClient' = 'engineToClient' syncDirection: 'clientToEngine' | 'engineToClient' = 'engineToClient'
@ -77,9 +98,8 @@ export class CameraControls {
enableRotate = true enableRotate = true
enablePan = true enablePan = true
enableZoom = true enableZoom = true
zoomDataFromLastFrame?: number = undefined moveSender: CameraRateLimiter = new CameraRateLimiter()
// holds coordinates, and interaction zoomSender: CameraRateLimiter = new CameraRateLimiter()
moveDataFromLastFrame?: [number, number, string] = undefined
lastPerspectiveFov: number = 45 lastPerspectiveFov: number = 45
pendingZoom: number | null = null pendingZoom: number | null = null
pendingRotation: Vector2 | null = null pendingRotation: Vector2 | null = null
@ -171,6 +191,36 @@ export class CameraControls {
} }
} }
doMove = (interaction: any, coordinates: any) => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.engineCommandManager.sendSceneCommand({
type: 'modeling_cmd_req',
cmd: {
type: 'camera_drag_move',
interaction: interaction,
window: {
x: coordinates[0],
y: coordinates[1],
},
},
cmd_id: uuidv4(),
})
}
doZoom = (zoom: number) => {
this.handleStart()
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.engineCommandManager.sendSceneCommand({
type: 'modeling_cmd_req',
cmd: {
type: 'default_camera_zoom',
magnitude: (-1 * zoom) / window.devicePixelRatio,
},
cmd_id: uuidv4(),
})
this.handleEnd()
}
constructor( constructor(
isOrtho = false, isOrtho = false,
domElement: HTMLCanvasElement, domElement: HTMLCanvasElement,
@ -258,49 +308,6 @@ export class CameraControls {
this.onCameraChange() this.onCameraChange()
} }
// Our stream is never more than 60fps.
// We can get away with capping our "virtual fps" to 60 then.
const FPS_VIRTUAL = 60
const doZoom = () => {
if (this.zoomDataFromLastFrame !== undefined) {
this.handleStart()
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.engineCommandManager.sendSceneCommand({
type: 'modeling_cmd_req',
cmd: {
type: 'default_camera_zoom',
magnitude:
(-1 * this.zoomDataFromLastFrame) / window.devicePixelRatio,
},
cmd_id: uuidv4(),
})
this.handleEnd()
}
this.zoomDataFromLastFrame = undefined
}
setInterval(doZoom, 1000 / FPS_VIRTUAL)
const doMove = () => {
if (this.moveDataFromLastFrame !== undefined) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.engineCommandManager.sendSceneCommand({
type: 'modeling_cmd_req',
cmd: {
type: 'camera_drag_move',
interaction: this.moveDataFromLastFrame[2] as any,
window: {
x: this.moveDataFromLastFrame[0],
y: this.moveDataFromLastFrame[1],
},
},
cmd_id: uuidv4(),
})
}
this.moveDataFromLastFrame = undefined
}
setInterval(doMove, 1000 / FPS_VIRTUAL)
setTimeout(() => { setTimeout(() => {
this.engineCommandManager.subscribeTo({ this.engineCommandManager.subscribeTo({
event: 'camera_drag_end', event: 'camera_drag_end',
@ -386,7 +393,9 @@ export class CameraControls {
if (interaction === 'none') return if (interaction === 'none') return
if (this.syncDirection === 'engineToClient') { if (this.syncDirection === 'engineToClient') {
this.moveDataFromLastFrame = [event.clientX, event.clientY, interaction] this.moveSender.send(() => {
this.doMove(interaction, [event.clientX, event.clientY])
})
return return
} }
@ -459,7 +468,9 @@ export class CameraControls {
if (this.syncDirection === 'engineToClient') { if (this.syncDirection === 'engineToClient') {
if (interaction === 'zoom') { if (interaction === 'zoom') {
this.zoomDataFromLastFrame = event.deltaY this.zoomSender.send(() => {
this.doZoom(event.deltaY)
})
} else { } else {
// This case will get handled when we add pan and rotate using Apple trackpad. // This case will get handled when we add pan and rotate using Apple trackpad.
console.error( console.error(

View File

@ -488,6 +488,12 @@ export const FileTreeInner = ({
// Refresh the file tree when there are changes. // Refresh the file tree when there are changes.
useFileSystemWatcher( useFileSystemWatcher(
async (eventType, path) => { async (eventType, path) => {
// Our other watcher races with this watcher on the current file changes,
// so we need to stop this one from reacting at all, otherwise Bad Things
// Happen™.
const isCurrentFile = loaderData.file?.path === path
const hasChanged = eventType === 'change'
if (isCurrentFile && hasChanged) return
fileSend({ type: 'Refresh' }) fileSend({ type: 'Refresh' })
}, },
[loaderData?.project?.path, fileContext.selectedDirectory.path].filter( [loaderData?.project?.path, fileContext.selectedDirectory.path].filter(

View File

@ -69,7 +69,7 @@ import { exportFromEngine } from 'lib/exportFromEngine'
import { Models } from '@kittycad/lib/dist/types/src' import { Models } from '@kittycad/lib/dist/types/src'
import toast from 'react-hot-toast' import toast from 'react-hot-toast'
import { EditorSelection, Transaction } from '@codemirror/state' import { EditorSelection, Transaction } from '@codemirror/state'
import { useNavigate, useSearchParams } from 'react-router-dom' import { useLoaderData, useNavigate, useSearchParams } from 'react-router-dom'
import { letEngineAnimateAndSyncCamAfter } from 'clientSideScene/CameraControls' import { letEngineAnimateAndSyncCamAfter } from 'clientSideScene/CameraControls'
import { getVarNameModal } from 'hooks/useToolbarGuards' import { getVarNameModal } from 'hooks/useToolbarGuards'
import { err, reportRejection, trap } from 'lib/trap' import { err, reportRejection, trap } from 'lib/trap'
@ -84,6 +84,7 @@ import {
import { submitAndAwaitTextToKcl } from 'lib/textToCad' import { submitAndAwaitTextToKcl } from 'lib/textToCad'
import { useFileContext } from 'hooks/useFileContext' import { useFileContext } from 'hooks/useFileContext'
import { uuidv4 } from 'lib/utils' import { uuidv4 } from 'lib/utils'
import { IndexLoaderData } from 'lib/types'
type MachineContext<T extends AnyStateMachine> = { type MachineContext<T extends AnyStateMachine> = {
state: StateFrom<T> state: StateFrom<T>
@ -116,6 +117,7 @@ export const ModelingMachineProvider = ({
} = useSettingsAuthContext() } = useSettingsAuthContext()
const navigate = useNavigate() const navigate = useNavigate()
const { context, send: fileMachineSend } = useFileContext() const { context, send: fileMachineSend } = useFileContext()
const { file } = useLoaderData() as IndexLoaderData
const token = auth?.context?.token const token = auth?.context?.token
const streamRef = useRef<HTMLDivElement>(null) const streamRef = useRef<HTMLDivElement>(null)
const persistedContext = useMemo(() => getPersistedContext(), []) const persistedContext = useMemo(() => getPersistedContext(), [])
@ -409,12 +411,15 @@ export const ModelingMachineProvider = ({
Make: ({ event }) => { Make: ({ event }) => {
if (event.type !== 'Make') return if (event.type !== 'Make') return
// Check if we already have an export intent. // Check if we already have an export intent.
if (engineCommandManager.exportIntent) { if (engineCommandManager.exportInfo) {
toast.error('Already exporting') toast.error('Already exporting')
return return
} }
// Set the export intent. // Set the export intent.
engineCommandManager.exportIntent = ExportIntent.Make engineCommandManager.exportInfo = {
intent: ExportIntent.Make,
name: file?.name || '',
}
// Set the current machine. // Set the current machine.
machineManager.currentMachine = event.data.machine machineManager.currentMachine = event.data.machine
@ -443,12 +448,16 @@ export const ModelingMachineProvider = ({
}, },
'Engine export': ({ event }) => { 'Engine export': ({ event }) => {
if (event.type !== 'Export') return if (event.type !== 'Export') return
if (engineCommandManager.exportIntent) { if (engineCommandManager.exportInfo) {
toast.error('Already exporting') toast.error('Already exporting')
return return
} }
// Set the export intent. // Set the export intent.
engineCommandManager.exportIntent = ExportIntent.Save engineCommandManager.exportInfo = {
intent: ExportIntent.Save,
// This never gets used its only for make.
name: '',
}
const format = { const format = {
...event.data, ...event.data,

View File

@ -18,6 +18,7 @@ export default class CodeManager {
#updateState: (arg: string) => void = () => {} #updateState: (arg: string) => void = () => {}
private _currentFilePath: string | null = null private _currentFilePath: string | null = null
private _hotkeys: { [key: string]: () => void } = {} private _hotkeys: { [key: string]: () => void } = {}
private timeoutWriter: ReturnType<typeof setTimeout> | undefined = undefined
constructor() { constructor() {
if (isDesktop()) { if (isDesktop()) {
@ -115,7 +116,11 @@ export default class CodeManager {
async writeToFile() { async writeToFile() {
if (isDesktop()) { if (isDesktop()) {
setTimeout(() => { // Only write our buffer contents to file once per second. Any faster
// and file-system watchers which read, will receive empty data during
// writes.
clearTimeout(this.timeoutWriter)
this.timeoutWriter = setTimeout(() => {
// Wait one event loop to give a chance for params to be set // Wait one event loop to give a chance for params to be set
// Save the file to disk // Save the file to disk
this._currentFilePath && this._currentFilePath &&
@ -126,7 +131,7 @@ export default class CodeManager {
console.error('error saving file', err) console.error('error saving file', err)
toast.error('Error saving file, please check file permissions') toast.error('Error saving file, please check file permissions')
}) })
}) }, 1000)
} else { } else {
safeLSSetItem(PERSIST_CODE_KEY, this.code) safeLSSetItem(PERSIST_CODE_KEY, this.code)
} }

View File

@ -50,6 +50,11 @@ export enum ExportIntent {
Make = 'make', Make = 'make',
} }
export interface ExportInfo {
intent: ExportIntent
name: string
}
type ClientMetrics = Models['ClientMetrics_type'] type ClientMetrics = Models['ClientMetrics_type']
interface WebRTCClientMetrics extends ClientMetrics { interface WebRTCClientMetrics extends ClientMetrics {
@ -1354,7 +1359,7 @@ export class EngineCommandManager extends EventTarget {
* export in progress. Otherwise it is an enum value of the intent. * export in progress. Otherwise it is an enum value of the intent.
* Another export cannot be started if one is already in progress. * Another export cannot be started if one is already in progress.
*/ */
private _exportIntent: ExportIntent | null = null private _exportInfo: ExportInfo | null = null
_commandLogCallBack: (command: CommandLog[]) => void = () => {} _commandLogCallBack: (command: CommandLog[]) => void = () => {}
subscriptions: { subscriptions: {
@ -1410,12 +1415,12 @@ export class EngineCommandManager extends EventTarget {
(() => {}) as any (() => {}) as any
kclManager: null | KclManager = null kclManager: null | KclManager = null
set exportIntent(intent: ExportIntent | null) { set exportInfo(info: ExportInfo | null) {
this._exportIntent = intent this._exportInfo = info
} }
get exportIntent() { get exportInfo() {
return this._exportIntent return this._exportInfo
} }
start({ start({
@ -1607,7 +1612,7 @@ export class EngineCommandManager extends EventTarget {
// because in all other cases we send JSON strings. But in the case of // because in all other cases we send JSON strings. But in the case of
// export we send a binary blob. // export we send a binary blob.
// Pass this to our export function. // Pass this to our export function.
if (this.exportIntent === null || this.pendingExport === undefined) { if (this.exportInfo === null || this.pendingExport === undefined) {
toast.error( toast.error(
'Export intent was not set, but export data was received' 'Export intent was not set, but export data was received'
) )
@ -1617,7 +1622,7 @@ export class EngineCommandManager extends EventTarget {
return return
} }
switch (this.exportIntent) { switch (this.exportInfo.intent) {
case ExportIntent.Save: { case ExportIntent.Save: {
exportSave(event.data, this.pendingExport.toastId).then(() => { exportSave(event.data, this.pendingExport.toastId).then(() => {
this.pendingExport?.resolve(null) this.pendingExport?.resolve(null)
@ -1625,21 +1630,22 @@ export class EngineCommandManager extends EventTarget {
break break
} }
case ExportIntent.Make: { case ExportIntent.Make: {
exportMake(event.data, this.pendingExport.toastId).then( exportMake(
(result) => { event.data,
this.exportInfo.name,
this.pendingExport.toastId
).then((result) => {
if (result) { if (result) {
this.pendingExport?.resolve(null) this.pendingExport?.resolve(null)
} else { } else {
this.pendingExport?.reject('Failed to make export') this.pendingExport?.reject('Failed to make export')
} }
}, }, this.pendingExport?.reject)
this.pendingExport?.reject
)
break break
} }
} }
// Set the export intent back to null. // Set the export intent back to null.
this.exportIntent = null this.exportInfo = null
return return
} }
@ -1953,15 +1959,15 @@ export class EngineCommandManager extends EventTarget {
return Promise.resolve(null) return Promise.resolve(null)
} else if (cmd.type === 'export') { } else if (cmd.type === 'export') {
const promise = new Promise<null>((resolve, reject) => { const promise = new Promise<null>((resolve, reject) => {
if (this.exportIntent === null) { if (this.exportInfo === null) {
if (this.exportIntent === null) { if (this.exportInfo === null) {
toast.error('Export intent was not set, but export is being sent') toast.error('Export intent was not set, but export is being sent')
console.error('Export intent was not set, but export is being sent') console.error('Export intent was not set, but export is being sent')
return return
} }
} }
const toastId = toast.loading( const toastId = toast.loading(
this.exportIntent === ExportIntent.Save this.exportInfo.intent === ExportIntent.Save
? EXPORT_TOAST_MESSAGES.START ? EXPORT_TOAST_MESSAGES.START
: MAKE_TOAST_MESSAGES.START : MAKE_TOAST_MESSAGES.START
) )
@ -1975,7 +1981,7 @@ export class EngineCommandManager extends EventTarget {
resolve(passThrough) resolve(passThrough)
}, },
reject: (reason: string) => { reject: (reason: string) => {
this.exportIntent = null this.exportInfo = null
reject(reason) reject(reason)
}, },
commandId: command.cmd_id, commandId: command.cmd_id,

View File

@ -110,6 +110,7 @@ const initialise = async () => {
const fullUrl = wasmUrl() const fullUrl = wasmUrl()
const input = await fetch(fullUrl) const input = await fetch(fullUrl)
const buffer = await input.arrayBuffer() const buffer = await input.arrayBuffer()
return await init(buffer) return await init(buffer)
} catch (e) { } catch (e) {
console.log('Error initialising WASM', e) console.log('Error initialising WASM', e)

View File

@ -92,6 +92,7 @@ export const MAKE_TOAST_MESSAGES = {
NO_MACHINE_API_IP: 'No machine api ip available', NO_MACHINE_API_IP: 'No machine api ip available',
NO_CURRENT_MACHINE: 'No current machine available', NO_CURRENT_MACHINE: 'No current machine available',
NO_MACHINE_ID: 'No machine id available', NO_MACHINE_ID: 'No machine id available',
NO_NAME: 'No name provided',
ERROR_STARTING_PRINT: 'Error while starting print', ERROR_STARTING_PRINT: 'Error while starting print',
SUCCESS: 'Started print successfully', SUCCESS: 'Started print successfully',
} }

31
src/lib/engineUtils.ts Normal file
View File

@ -0,0 +1,31 @@
import EngineUtils from '@engine-utils'
type KCEngineUtilsEvaluatePath = {
(sketch: string, t: number): string
}
let kcEngineUtilsEvaluatePath: KCEngineUtilsEvaluatePath
export async function init() {
return await new Promise((resolve, reject) => {
try {
EngineUtils().then((module) => {
kcEngineUtilsEvaluatePath = module.cwrap(
'kcEngineUtilsEvaluatePath',
'string',
['string', 'number']
)
resolve(true)
})
} catch (e) {
reject(e)
}
})
}
export async function getTruePathEndPos(sketch: string) {
if (!kcEngineUtilsEvaluatePath) {
await init()
}
return kcEngineUtilsEvaluatePath(sketch, 1.0)
}

View File

@ -8,8 +8,15 @@ import { MAKE_TOAST_MESSAGES } from './constants'
// Make files locally from an export call. // Make files locally from an export call.
export async function exportMake( export async function exportMake(
data: ArrayBuffer, data: ArrayBuffer,
name: string,
toastId: string toastId: string
): Promise<Response | null> { ): Promise<Response | null> {
if (name === '') {
console.error(MAKE_TOAST_MESSAGES.NO_NAME)
toast.error(MAKE_TOAST_MESSAGES.NO_NAME, { id: toastId })
return null
}
if (machineManager.machineCount() === 0) { if (machineManager.machineCount() === 0) {
console.error(MAKE_TOAST_MESSAGES.NO_MACHINES) console.error(MAKE_TOAST_MESSAGES.NO_MACHINES)
toast.error(MAKE_TOAST_MESSAGES.NO_MACHINES, { id: toastId }) toast.error(MAKE_TOAST_MESSAGES.NO_MACHINES, { id: toastId })
@ -39,7 +46,7 @@ export async function exportMake(
const params: components['schemas']['PrintParameters'] = { const params: components['schemas']['PrintParameters'] = {
machine_id: machineId, machine_id: machineId,
job_name: 'Exported Job', // TODO: make this the project name. job_name: name,
} }
try { try {
console.log('params', params) console.log('params', params)

View File

@ -121,9 +121,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.89" version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8"
dependencies = [ dependencies = [
"backtrace", "backtrace",
] ]
@ -1684,9 +1684,9 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-modeling-cmds" name = "kittycad-modeling-cmds"
version = "0.2.68" version = "0.2.70"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e3aedfcc1d8ea9995ec3eb78a6743c585c9380475c48701797f107489b696aa" checksum = "b135696d07a4fab928e5abace4dd05f4976eafab5d73e5747a85dc5a684b936c"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",
@ -3005,9 +3005,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.128" version = "1.0.132"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03"
dependencies = [ dependencies = [
"indexmap 2.6.0", "indexmap 2.6.0",
"itoa", "itoa",

View File

@ -72,7 +72,7 @@ members = [
[workspace.dependencies] [workspace.dependencies]
http = "1" http = "1"
kittycad = { version = "0.3.23", default-features = false, features = ["js", "requests"] } kittycad = { version = "0.3.23", default-features = false, features = ["js", "requests"] }
kittycad-modeling-cmds = { version = "0.2.68", features = ["websocket"] } kittycad-modeling-cmds = { version = "0.2.70", features = ["websocket"] }
[[test]] [[test]]
name = "executor" name = "executor"

View File

@ -12,7 +12,7 @@ fn basic() {
let expected = Program { let expected = Program {
start: 0, start: 0,
end: 11, end: 11,
body: vec![BodyItem::VariableDeclaration(VariableDeclaration { body: vec![BodyItem::VariableDeclaration(Box::new(VariableDeclaration {
start: 0, start: 0,
end: 11, end: 11,
declarations: vec![VariableDeclarator { declarations: vec![VariableDeclarator {
@ -36,7 +36,7 @@ fn basic() {
visibility: ItemVisibility::Default, visibility: ItemVisibility::Default,
kind: VariableKind::Const, kind: VariableKind::Const,
digest: None, digest: None,
})], }))],
non_code_meta: NonCodeMeta::default(), non_code_meta: NonCodeMeta::default(),
digest: None, digest: None,
}; };

View File

@ -68,7 +68,7 @@ tokio-tungstenite = { version = "0.24.0", features = ["rustls-tls-native-roots"]
tower-lsp = { version = "0.20.0", features = ["proposed"] } tower-lsp = { version = "0.20.0", features = ["proposed"] }
[features] [features]
default = ["engine"] default = ["engine"] # add wasm-engine-utils here when we're ready
cli = ["dep:clap"] cli = ["dep:clap"]
# For the lsp server, when run with stdout for rpc we want to disable println. # For the lsp server, when run with stdout for rpc we want to disable println.
# This is used for editor extensions that use the lsp server. # This is used for editor extensions that use the lsp server.
@ -77,6 +77,10 @@ engine = []
pyo3 = ["dep:pyo3"] pyo3 = ["dep:pyo3"]
# Helper functions also used in benchmarks. # Helper functions also used in benchmarks.
lsp-test-util = [] lsp-test-util = []
#if enabled, kcl will link directly against a wasm build of the engine utils lib to save latency
wasm-engine-utils = []
#if enabled, kcl will link directly against a native build of the engine utils lib to save latency (not yet functional)
native-engine-utils = []
tabled = ["dep:tabled"] tabled = ["dep:tabled"]

View File

@ -454,7 +454,7 @@ pub(crate) use impl_value_meta;
pub enum BodyItem { pub enum BodyItem {
ImportStatement(Box<ImportStatement>), ImportStatement(Box<ImportStatement>),
ExpressionStatement(ExpressionStatement), ExpressionStatement(ExpressionStatement),
VariableDeclaration(VariableDeclaration), VariableDeclaration(Box<VariableDeclaration>),
ReturnStatement(ReturnStatement), ReturnStatement(ReturnStatement),
} }
@ -2719,7 +2719,7 @@ pub struct FunctionExpression {
impl_value_meta!(FunctionExpression); impl_value_meta!(FunctionExpression);
#[derive(Debug, PartialEq, Clone)] #[derive(Debug, PartialEq, Clone)]
pub struct RequiredParamAfterOptionalParam(pub Parameter); pub struct RequiredParamAfterOptionalParam(pub Box<Parameter>);
impl std::fmt::Display for RequiredParamAfterOptionalParam { impl std::fmt::Display for RequiredParamAfterOptionalParam {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@ -2751,7 +2751,7 @@ impl FunctionExpression {
if param.optional { if param.optional {
found_optional = true; found_optional = true;
} else if found_optional { } else if found_optional {
return Err(RequiredParamAfterOptionalParam(param.clone())); return Err(RequiredParamAfterOptionalParam(Box::new(param.clone())));
} }
} }
let boundary = self.params.partition_point(|param| !param.optional); let boundary = self.params.partition_point(|param| !param.optional);

View File

@ -551,13 +551,13 @@ impl ArrayRangeExpression {
.execute_expr(&self.start_element, exec_state, &metadata, StatementKind::Expression) .execute_expr(&self.start_element, exec_state, &metadata, StatementKind::Expression)
.await? .await?
.get_json_value()?; .get_json_value()?;
let start = parse_json_number_as_u64(&start, (&*self.start_element).into())?; let start = parse_json_number_as_i64(&start, (&*self.start_element).into())?;
let metadata = Metadata::from(&*self.end_element); let metadata = Metadata::from(&*self.end_element);
let end = ctx let end = ctx
.execute_expr(&self.end_element, exec_state, &metadata, StatementKind::Expression) .execute_expr(&self.end_element, exec_state, &metadata, StatementKind::Expression)
.await? .await?
.get_json_value()?; .get_json_value()?;
let end = parse_json_number_as_u64(&end, (&*self.end_element).into())?; let end = parse_json_number_as_i64(&end, (&*self.end_element).into())?;
if end < start { if end < start {
return Err(KclError::Semantic(KclErrorDetails { return Err(KclError::Semantic(KclErrorDetails {
@ -603,9 +603,9 @@ impl ObjectExpression {
} }
} }
pub fn parse_json_number_as_u64(j: &serde_json::Value, source_range: SourceRange) -> Result<u64, KclError> { fn parse_json_number_as_i64(j: &serde_json::Value, source_range: SourceRange) -> Result<i64, KclError> {
if let serde_json::Value::Number(n) = &j { if let serde_json::Value::Number(n) = &j {
n.as_u64().ok_or_else(|| { n.as_i64().ok_or_else(|| {
KclError::Syntax(KclErrorDetails { KclError::Syntax(KclErrorDetails {
source_ranges: vec![source_range], source_ranges: vec![source_range],
message: format!("Invalid integer: {}", j), message: format!("Invalid integer: {}", j),

View File

@ -0,0 +1,57 @@
//! Functions for calling into the engine-utils library (a set of C++ utilities containing various logic for client-side CAD processing)
//! Note that this binary may not be available to all builds of kcl, so fallbacks that call the engine API should be implemented
use crate::{
errors::{KclError, KclErrorDetails},
std::Args,
};
use anyhow::Result;
use std::ffi::{CString, CStr};
use kittycad_modeling_cmds::{length_unit::LengthUnit, shared::Point3d};
mod cpp {
use std::os::raw::c_char;
extern "C" {
pub fn kcEngineUtilsEvaluatePath(sketch: *const c_char, t: f64) -> *const c_char;
}
}
pub fn is_available() -> bool {
true
}
pub async fn get_true_path_end_pos(sketch: String, args: &Args) -> Result<Point3d<LengthUnit>, KclError> {
let c_string = CString::new(sketch).map_err(|e| {
KclError::Internal(KclErrorDetails {
message: format!("{:?}", e),
source_ranges: vec![args.source_range],
})
})?;
let arg = c_string.into_raw();
let result_string: String;
unsafe {
let result = cpp::kcEngineUtilsEvaluatePath(arg, 1.0);
let result_cstr = CStr::from_ptr(result);
let str_slice: &str = result_cstr.to_str().map_err(|e| {
KclError::Internal(KclErrorDetails {
message: format!("{:?}", e),
source_ranges: vec![args.source_range],
})
})?;
let str_buf: String = str_slice.to_owned();
result_string = str_buf.clone();
let _ = CString::from_raw(arg);
}
let point: Point3d<f64> = serde_json::from_str(&result_string).map_err(|e| {
KclError::Type(KclErrorDetails {
message: format!("Failed to path position from json: {}", e),
source_ranges: vec![args.source_range],
})
})?;
Ok(Point3d::<f64>::from(point).map(LengthUnit))
}

View File

@ -0,0 +1,35 @@
//! Functions for calling into the engine-utils library (a set of C++ utilities containing various logic for client-side CAD processing)
//! Note that this binary may not be available to all builds of kcl, so fallbacks that call the engine API should be implemented
use crate::{
errors::{KclError, KclErrorDetails},
std::Args,
};
use crate::engine::kcmc::{each_cmd as mcmd, ModelingCmd};
use anyhow::Result;
use kittycad_modeling_cmds::{length_unit::LengthUnit, ok_response::OkModelingCmdResponse, shared::Point3d, websocket::OkWebSocketResponseData};
pub fn is_available() -> bool {
true
}
pub async fn get_true_path_end_pos(sketch: String, args: &Args) -> Result<Point3d<LengthUnit>, KclError> {
let id = uuid::Uuid::new_v4();
let resp = args.send_modeling_cmd(id, ModelingCmd::from(mcmd::EngineUtilEvaluatePath {
path_json: sketch,
t: 1.0,
})).await?;
let OkWebSocketResponseData::Modeling {
modeling_response: OkModelingCmdResponse::EngineUtilEvaluatePath(point),
} = &resp
else {
return Err(KclError::Engine(KclErrorDetails {
message: format!("mcmd::EngineUtilEvaluatePath response was not as expected: {:?}", resp),
source_ranges: vec![args.source_range],
}));
};
Ok(point.pos)
}

View File

@ -0,0 +1,56 @@
//! Functions for calling into the engine-utils library (a set of C++ utilities containing various logic for client-side CAD processing)
//! Note that this binary may not be available to all builds of kcl, so fallbacks that call the engine API should be implemented
use crate::{
errors::{KclError, KclErrorDetails},
std::Args,
};
use anyhow::Result;
use kittycad_modeling_cmds::{length_unit::LengthUnit, shared::Point3d};
mod cpp {
use wasm_bindgen::prelude::wasm_bindgen;
#[wasm_bindgen(module = "/../../lib/engineUtils.ts")]
extern "C" {
#[wasm_bindgen(js_name = getTruePathEndPos, catch)]
pub fn get_true_path_end_pos(sketch: String) -> Result<js_sys::Promise, js_sys::Error>;
}
}
pub fn is_available() -> bool {
true
}
async fn call_cpp<F>(args: &Args, f: F) -> Result<String, KclError>
where
F: FnOnce() -> Result<js_sys::Promise, js_sys::Error>,
{
let promise = f().map_err(|e| {
KclError::Internal(KclErrorDetails {
message: format!("{:?}", e),
source_ranges: vec![args.source_range],
})
})?;
let result = crate::wasm::JsFuture::from(promise).await.map_err(|e| {
KclError::Internal(KclErrorDetails {
message: format!("{:?}", e),
source_ranges: vec![args.source_range],
})
})?;
Ok(result.as_string().unwrap_or_default())
}
pub async fn get_true_path_end_pos(sketch: String, args: &Args) -> Result<Point3d<LengthUnit>, KclError> {
let result_str = call_cpp(args, || cpp::get_true_path_end_pos(sketch.into())).await?;
let point: Point3d<f64> = serde_json::from_str(&result_str).map_err(|e| {
KclError::Type(KclErrorDetails {
message: format!("Failed to path position from json: {}", e),
source_ranges: vec![args.source_range],
})
})?;
Ok(Point3d::<f64>::from(point).map(LengthUnit))
}

View File

@ -8,6 +8,17 @@ pub mod conn_mock;
#[cfg(feature = "engine")] #[cfg(feature = "engine")]
pub mod conn_wasm; pub mod conn_wasm;
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "native-engine-utils")]
pub mod engine_utils;
#[cfg(target_arch = "wasm32")]
#[cfg(feature = "wasm-engine-utils")]
pub mod engine_utils_wasm;
#[cfg(feature = "engine")]
#[cfg(any(not(target_arch = "wasm32"), all(not(feature = "native-engine-utils"), not(feature = "wasm-engine-utils"))))]
pub mod engine_utils_api;
use std::{ use std::{
collections::HashMap, collections::HashMap,
sync::{Arc, Mutex}, sync::{Arc, Mutex},

View File

@ -1601,6 +1601,19 @@ pub enum Path {
#[serde(flatten)] #[serde(flatten)]
base: BasePath, base: BasePath,
}, },
/// An arc (only used for engine-utils arg serialization for now)
Arc {
#[serde(flatten)]
base: BasePath,
/// angle range
#[ts(type = "[number, number]")]
angle_range: [f64; 2],
/// center
#[ts(type = "[number, number]")]
center: [f64; 2],
/// the arc's radius
radius: f64,
},
/// A arc that is tangential to the last path segment that goes to a point /// A arc that is tangential to the last path segment that goes to a point
TangentialArcTo { TangentialArcTo {
#[serde(flatten)] #[serde(flatten)]
@ -1620,6 +1633,10 @@ pub enum Path {
center: [f64; 2], center: [f64; 2],
/// arc's direction /// arc's direction
ccw: bool, ccw: bool,
/// the arc's radius
radius: f64,
/// the arc's angle offset
offset: f64,
}, },
// TODO: consolidate segment enums, remove Circle. https://github.com/KittyCAD/modeling-app/issues/3940 // TODO: consolidate segment enums, remove Circle. https://github.com/KittyCAD/modeling-app/issues/3940
/// a complete arc /// a complete arc
@ -1668,6 +1685,7 @@ impl Path {
Path::TangentialArcTo { base, .. } => base.geo_meta.id, Path::TangentialArcTo { base, .. } => base.geo_meta.id,
Path::TangentialArc { base, .. } => base.geo_meta.id, Path::TangentialArc { base, .. } => base.geo_meta.id,
Path::Circle { base, .. } => base.geo_meta.id, Path::Circle { base, .. } => base.geo_meta.id,
Path::Arc { base, .. } => base.geo_meta.id,
} }
} }
@ -1680,6 +1698,7 @@ impl Path {
Path::TangentialArcTo { base, .. } => base.tag.clone(), Path::TangentialArcTo { base, .. } => base.tag.clone(),
Path::TangentialArc { base, .. } => base.tag.clone(), Path::TangentialArc { base, .. } => base.tag.clone(),
Path::Circle { base, .. } => base.tag.clone(), Path::Circle { base, .. } => base.tag.clone(),
Path::Arc { base, .. } => base.tag.clone(),
} }
} }
@ -1692,6 +1711,7 @@ impl Path {
Path::TangentialArcTo { base, .. } => base, Path::TangentialArcTo { base, .. } => base,
Path::TangentialArc { base, .. } => base, Path::TangentialArc { base, .. } => base,
Path::Circle { base, .. } => base, Path::Circle { base, .. } => base,
Path::Arc { base, .. } => base,
} }
} }
@ -1704,6 +1724,7 @@ impl Path {
Path::TangentialArcTo { base, .. } => Some(base), Path::TangentialArcTo { base, .. } => Some(base),
Path::TangentialArc { base, .. } => Some(base), Path::TangentialArc { base, .. } => Some(base),
Path::Circle { base, .. } => Some(base), Path::Circle { base, .. } => Some(base),
Path::Arc { base, .. } => Some(base),
} }
} }
} }

View File

@ -1342,7 +1342,7 @@ fn declaration_keyword(i: TokenSlice) -> PResult<(VariableKind, Token)> {
} }
/// Parse a variable/constant declaration. /// Parse a variable/constant declaration.
fn declaration(i: TokenSlice) -> PResult<VariableDeclaration> { fn declaration(i: TokenSlice) -> PResult<Box<VariableDeclaration>> {
let (visibility, visibility_token) = opt(terminated(item_visibility, whitespace)) let (visibility, visibility_token) = opt(terminated(item_visibility, whitespace))
.parse_next(i)? .parse_next(i)?
.map_or((ItemVisibility::Default, None), |pair| (pair.0, Some(pair.1))); .map_or((ItemVisibility::Default, None), |pair| (pair.0, Some(pair.1)));
@ -1404,7 +1404,7 @@ fn declaration(i: TokenSlice) -> PResult<VariableDeclaration> {
.map_err(|e| e.cut())?; .map_err(|e| e.cut())?;
let end = val.end(); let end = val.end();
Ok(VariableDeclaration { Ok(Box::new(VariableDeclaration {
start, start,
end, end,
declarations: vec![VariableDeclarator { declarations: vec![VariableDeclarator {
@ -1417,7 +1417,7 @@ fn declaration(i: TokenSlice) -> PResult<VariableDeclaration> {
visibility, visibility,
kind, kind,
digest: None, digest: None,
}) }))
} }
impl TryFrom<Token> for Identifier { impl TryFrom<Token> for Identifier {

View File

@ -256,6 +256,7 @@ pub(crate) async fn do_post_extrude(
}); });
Some(extrude_surface) Some(extrude_surface)
} }
Path::Arc { .. } => todo!(),
} }
} else if args.ctx.is_mock() { } else if args.ctx.is_mock() {
// Only pre-populate the extrude surface if we are in mock mode. // Only pre-populate the extrude surface if we are in mock mode.

View File

@ -6,7 +6,7 @@ use anyhow::Result;
use derive_docs::stdlib; use derive_docs::stdlib;
use kcmc::shared::Point2d as KPoint2d; // Point2d is already defined in this pkg, to impl ts_rs traits. use kcmc::shared::Point2d as KPoint2d; // Point2d is already defined in this pkg, to impl ts_rs traits.
use kcmc::{each_cmd as mcmd, length_unit::LengthUnit, shared::Angle, ModelingCmd}; use kcmc::{each_cmd as mcmd, length_unit::LengthUnit, shared::Angle, ModelingCmd};
use kittycad_modeling_cmds as kcmc; use kittycad_modeling_cmds::{self as kcmc, units};
use kittycad_modeling_cmds::shared::PathSegment; use kittycad_modeling_cmds::shared::PathSegment;
use parse_display::{Display, FromStr}; use parse_display::{Display, FromStr};
use schemars::JsonSchema; use schemars::JsonSchema;
@ -21,13 +21,26 @@ use crate::{
}, },
std::{ std::{
utils::{ utils::{
arc_angles, arc_center_and_end, get_tangent_point_from_previous_arc, get_tangential_arc_to_info, arc_angles, arc_center_and_end, arc_start_center_and_end, get_tangent_point_from_previous_arc,
get_x_component, get_y_component, intersection_with_parallel_line, TangentialArcInfoInput, get_tangential_arc_to_info, get_x_component, get_y_component, intersection_with_parallel_line,
TangentialArcInfoInput,
}, },
Args, Args,
}, },
}; };
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "native-engine-utils")]
use crate::engine::engine_utils;
#[cfg(target_arch = "wasm32")]
#[cfg(feature = "wasm-engine-utils")]
use crate::engine::engine_utils_wasm as engine_utils;
#[cfg(feature = "engine")]
#[cfg(any(not(target_arch = "wasm32"), all(not(feature = "native-engine-utils"), not(feature = "wasm-engine-utils"))))]
use crate::engine::engine_utils_api as engine_utils;
/// A tag for a face. /// A tag for a face.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)] #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
#[ts(export)] #[ts(export)]
@ -1495,7 +1508,45 @@ pub(crate) async fn inner_arc(
} => { } => {
let a_start = Angle::from_degrees(*angle_start); let a_start = Angle::from_degrees(*angle_start);
let a_end = Angle::from_degrees(*angle_end); let a_end = Angle::from_degrees(*angle_end);
let (center, end) = arc_center_and_end(from, a_start, a_end, *radius);
let (_, center, mut end) = arc_start_center_and_end(from, a_start, a_end, *radius);
if engine_utils::is_available() {
let mut path_plus_arc = sketch.clone();
let to = [0.0, 0.0];
let arc = Path::Arc {
base: BasePath {
from: from.into(),
to,
tag: None,
geo_meta: GeoMeta {
id: uuid::Uuid::new_v4(),
metadata: args.source_range.into(),
},
},
angle_range: [*angle_start, *angle_end],
center: [center.x, center.y],
radius: *radius,
};
path_plus_arc.value.push(arc);
let sketch_json_value = serde_json::to_string(&path_plus_arc).map_err(|e| {
KclError::Type(KclErrorDetails {
message: format!("Failed to convert sketch to json: {}", e),
source_ranges: vec![args.source_range],
})
})?;
//???? someone double check me on this unit conversion - mike
let units = units::UnitLength::Millimeters;
let result_end = engine_utils::get_true_path_end_pos(sketch_json_value, &args).await?;
end = Point2d {
x: result_end.x.to_millimeters(units),
y: result_end.y.to_millimeters(units),
};
}
(center, a_start, a_end, *radius, end) (center, a_start, a_end, *radius, end)
} }
ArcData::CenterToRadius { center, to, radius } => { ArcData::CenterToRadius { center, to, radius } => {
@ -1616,7 +1667,7 @@ async fn inner_tangential_arc(
let id = exec_state.id_generator.next_uuid(); let id = exec_state.id_generator.next_uuid();
let (center, to, ccw) = match data { let (center, to, ccw, radius, offset) = match data {
TangentialArcData::RadiusAndOffset { radius, offset } => { TangentialArcData::RadiusAndOffset { radius, offset } => {
// KCL stdlib types use degrees. // KCL stdlib types use degrees.
let offset = Angle::from_degrees(offset); let offset = Angle::from_degrees(offset);
@ -1654,13 +1705,15 @@ async fn inner_tangential_arc(
}), }),
) )
.await?; .await?;
(center, to.into(), ccw) (center, to.into(), ccw, radius, offset)
} }
}; };
let current_path = Path::TangentialArc { let current_path = Path::TangentialArc {
ccw, ccw,
center: center.into(), center: center.into(),
radius,
offset: offset.to_degrees(),
base: BasePath { base: BasePath {
from: from.into(), from: from.into(),
to, to,

View File

@ -221,6 +221,33 @@ pub fn arc_center_and_end(from: Point2d, start_angle: Angle, end_angle: Angle, r
(center, end) (center, end)
} }
pub fn arc_start_center_and_end(
from: Point2d,
start_angle: Angle,
end_angle: Angle,
radius: f64,
) -> (Point2d, Point2d, Point2d) {
let start_angle = start_angle.to_radians();
let end_angle = end_angle.to_radians();
let center = Point2d {
x: -1.0 * (radius * start_angle.cos() - from.x),
y: -1.0 * (radius * start_angle.sin() - from.y),
};
let start = Point2d {
x: center.x + radius * start_angle.cos(),
y: center.y + radius * start_angle.sin(),
};
let end = Point2d {
x: center.x + radius * end_angle.cos(),
y: center.y + radius * end_angle.sin(),
};
(start, center, end)
}
pub fn arc_angles( pub fn arc_angles(
from: Point2d, from: Point2d,
to: Point2d, to: Point2d,

View File

@ -290,7 +290,7 @@ where
walk_value(&xs.expression, f) walk_value(&xs.expression, f)
} }
BodyItem::VariableDeclaration(vd) => { BodyItem::VariableDeclaration(vd) => {
if !f.walk(vd.into())? { if !f.walk(vd.as_ref().into())? {
return Ok(false); return Ok(false);
} }
for dec in &vd.declarations { for dec in &vd.declarations {

View File

@ -1,3 +1,3 @@
[toolchain] [toolchain]
channel = "1.81.0" channel = "1.82.0"
components = ["clippy", "rustfmt"] components = ["clippy", "rustfmt"]

View File

@ -1,3 +1,2 @@
xs = [-5..5] xs = [int(-5)..5]
assertEqual(xs[0], -5, 0.001, "first element is -5") assertEqual(xs[0], -5, 0.001, "first element is -5")
assert(false)

View File

@ -101,7 +101,7 @@ gen_test!(property_of_object);
gen_test!(index_of_array); gen_test!(index_of_array);
gen_test!(comparisons); gen_test!(comparisons);
gen_test!(array_range_expr); gen_test!(array_range_expr);
gen_test_fail!(array_range_negative_expr, "syntax: Invalid integer: -5.0"); gen_test!(array_range_negative_expr);
gen_test_fail!( gen_test_fail!(
invalid_index_str, invalid_index_str,
"semantic: Only integers >= 0 can be used as the index of an array, but you're using a string" "semantic: Only integers >= 0 can be used as the index of an array, but you're using a string"

View File

@ -58,6 +58,7 @@ const config = defineConfig({
resolve: { resolve: {
alias: { alias: {
'@kittycad/codemirror-lsp-client': '/packages/codemirror-lsp-client/src', '@kittycad/codemirror-lsp-client': '/packages/codemirror-lsp-client/src',
'@engine-utils': '/src/lib/engine-utils/engine.js',
}, },
}, },
plugins: [react(), viteTsconfigPaths(), eslint(), version(), lezer()], plugins: [react(), viteTsconfigPaths(), eslint(), version(), lezer()],