refactor selections (#876)

* migrate selection types

* extract selection event into selections.ts

* move code-mirror selection functions into selections.ts

* move more selection logit out of code mirror and engine connection

* add selection functions pure

* tidy up naming

* write a novel about how selections work

* final comments
This commit is contained in:
Kurt Hutten
2023-10-16 21:20:05 +11:00
committed by GitHub
parent 8fad9ef3c2
commit 35b5ad7d9b
23 changed files with 466 additions and 349 deletions

View File

@ -1,4 +1,5 @@
import { Selections, toolTips } from '../../useStore'
import { toolTips } from '../../useStore'
import { Selections } from 'lib/selections'
import { Program, Value, VariableDeclarator } from '../../lang/wasm'
import {
getNodePathFromSourceRange,

View File

@ -1,4 +1,5 @@
import { Selections, toolTips } from '../../useStore'
import { toolTips } from '../../useStore'
import { Selections } from 'lib/selections'
import { Program, Value, VariableDeclarator } from '../../lang/wasm'
import {
getNodePathFromSourceRange,

View File

@ -1,4 +1,5 @@
import { toolTips } from '../../useStore'
import { Selections } from 'lib/selections'
import { Program, ProgramMemory, Value } from '../../lang/wasm'
import {
getNodePathFromSourceRange,
@ -10,7 +11,6 @@ import {
transformAstSketchLines,
} from '../../lang/std/sketchcombos'
import { kclManager } from 'lang/KclSinglton'
import { Selections } from 'useStore'
export function horzVertInfo(
selectionRanges: Selections,

View File

@ -1,4 +1,5 @@
import { Selections, toolTips } from '../../useStore'
import { toolTips } from '../../useStore'
import { Selections } from 'lib/selections'
import { BinaryPart, Program, Value, VariableDeclarator } from '../../lang/wasm'
import {
getNodePathFromSourceRange,

View File

@ -1,4 +1,5 @@
import { Selections, toolTips } from '../../useStore'
import { toolTips } from '../../useStore'
import { Selections } from 'lib/selections'
import { Program, Value } from '../../lang/wasm'
import {
getNodePathFromSourceRange,

View File

@ -1,4 +1,5 @@
import { Selections, toolTips } from '../../useStore'
import { toolTips } from '../../useStore'
import { Selections } from 'lib/selections'
import { BinaryPart, Program, Value } from '../../lang/wasm'
import {
getNodePathFromSourceRange,

View File

@ -1,4 +1,5 @@
import { Selections, toolTips } from '../../useStore'
import { toolTips } from '../../useStore'
import { Selections } from 'lib/selections'
import { BinaryPart, Program, Value, VariableDeclarator } from '../../lang/wasm'
import {
getNodePathFromSourceRange,

View File

@ -14,7 +14,7 @@ import { GetInfoModal, createInfoModal } from '../SetHorVertDistanceModal'
import { createLiteral, createVariableDeclaration } from '../../lang/modifyAst'
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
import { kclManager } from 'lang/KclSinglton'
import { Selections } from 'useStore'
import { Selections } from 'lib/selections'
const getModalInfo = createInfoModal(GetInfoModal)

View File

@ -1,4 +1,5 @@
import { Selections, toolTips } from '../../useStore'
import { toolTips } from '../../useStore'
import { Selections } from 'lib/selections'
import { BinaryPart, Program, Value } from '../../lang/wasm'
import {
getNodePathFromSourceRange,