Linear patterns (#1362)

* add linear patterns

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix clippy

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* add failing test for serialisation issue

* cleanup tests

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* cleanup memoryitem

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* add test to serialize memory item from rust

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* update test

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* run cargo sort everywhere

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* run fmt everywhere

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix typo

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* clean up linear paterns on re-execute

* selections fix for patterns

* fix clippy

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch>
This commit is contained in:
Jess Frazelle
2024-02-11 15:08:54 -08:00
committed by GitHub
parent 8378eb1e94
commit b94c5be1af
30 changed files with 3170 additions and 531 deletions

View File

@ -1075,7 +1075,7 @@ export class EngineCommandManager {
if (command && command.type === 'pending') {
const resolve = command.resolve
this.artifactMap[id] = {
const artifact = {
type: 'result',
range: command.range,
pathToNode: command.pathToNode,
@ -1083,6 +1083,13 @@ export class EngineCommandManager {
parentId: command.parentId ? command.parentId : undefined,
data: modelingResponse,
raw: message,
} as const
this.artifactMap[id] = artifact
if (command.commandType === 'entity_linear_pattern') {
const entities = (modelingResponse as any)?.data?.entity_ids
entities?.forEach((entity: string) => {
this.artifactMap[entity] = artifact
})
}
resolve({
id,
@ -1194,12 +1201,14 @@ export class EngineCommandManager {
// this fact is very opaque in the api and docs (as to what should can be deleted).
// Using an array is the list is likely to grow.
'start_path',
'entity_linear_pattern',
]
if (!artifactTypesToDelete.includes(artifact.commandType)) return
artifactsToDelete[id] = artifact
if (artifactTypesToDelete.includes(artifact.commandType)) {
artifactsToDelete[id] = artifact
}
})
Object.keys(artifactsToDelete).forEach((id) => {
const deletCmd: EngineCommand = {
const deleteCmd: EngineCommand = {
type: 'modeling_cmd_req',
cmd_id: uuidv4(),
cmd: {
@ -1207,7 +1216,7 @@ export class EngineCommandManager {
object_ids: [id],
},
}
this.engineConnection?.send(deletCmd)
this.engineConnection?.send(deleteCmd)
})
}
addCommandLog(message: CommandLog) {