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

@ -352,7 +352,7 @@ export function processCodeMirrorRanges({
}
})
const idBasedSelections: SelectionToEngine[] = codeBasedSelections
.map(({ type, range }): null | SelectionToEngine => {
.flatMap(({ type, range }): null | SelectionToEngine[] => {
// TODO #868: loops over all artifacts will become inefficient at a large scale
const entriesWithOverlap = Object.entries(
engineCommandManager.artifactMap || {}
@ -362,8 +362,7 @@ export function processCodeMirrorRanges({
: false
})
if (entriesWithOverlap.length) {
const [id, artifact] = entriesWithOverlap?.[0]
return {
return entriesWithOverlap.map(([id, artifact]) => ({
type,
id:
type === 'line-end' &&
@ -371,7 +370,7 @@ export function processCodeMirrorRanges({
artifact.headVertexId
? artifact.headVertexId
: id,
}
}))
}
return null
})