Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor codeToIdSelections #5432

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Conversation

Irev-Dev
Copy link
Collaborator

@Irev-Dev Irev-Dev commented Feb 20, 2025

I had planned on doing a bigger refactor of selections to fix some problems with delete, I still think I should but I was finding I was getting a bit lost/ scatter-brain and there's other higher priority work so here's a refactor to get ride of some deprecated functions.

  • Removing deprecated code and simplifying the selection system by removing the old Selection__old type and related conversion functions
  • Adding ArtifactGraph as a required parameter to functions that need it, rather than accessing it through a singleton manager
  • Simplifying the codeToIdSelections function by making it more focused on direct artifact lookups and removing complex type-based logic
  • Stopping the double loop inside codeToIdSelections by adding an ordered array each time the artifactGraph is added. Ordered by startRange index, that way a binary tree search can be used to find the first artifact that might be relevant, looping through them from that point until startRange1 > endRange2 (no possible overlap). This was a refactor I had meant to do for ages, that could eventually bite us with big scenes.
  • Removing unnecessary type field from SelectionToEngine

Copy link

qa-wolf bot commented Feb 20, 2025

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

Copy link

vercel bot commented Feb 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
modeling-app ✅ Ready (Inspect) Visit Preview Feb 21, 2025 6:13am

Copy link

codecov bot commented Feb 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.07%. Comparing base (96b93f8) to head (055eb0a).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5432   +/-   ##
=======================================
  Coverage   86.07%   86.07%           
=======================================
  Files          95       95           
  Lines       35523    35523           
=======================================
  Hits        30576    30576           
  Misses       4947     4947           
Flag Coverage Δ
wasm-lib 86.07% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Irev-Dev Irev-Dev changed the title add test for original range to artifact conversion Kurt's WIP selection/deletion branch Feb 20, 2025
@Irev-Dev Irev-Dev changed the title Kurt's WIP selection/deletion branch refactor codeToIdSelections Feb 21, 2025
@Irev-Dev Irev-Dev requested review from nadr0 and pierremtb February 21, 2025 00:03
@Irev-Dev Irev-Dev self-assigned this Feb 21, 2025
@Irev-Dev Irev-Dev marked this pull request as ready for review February 21, 2025 00:03
@@ -0,0 +1,1232 @@
import { expect } from 'vitest'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This files tests were here to capture previous behaviour to give me some piece of mind when refactoring

radius = 42.72
}, sketch003)
`
const ___artifactGraph = new Map([
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtran I ended up pasting the entire artifactGraph for this snippet in, because there's no artifactGraph in mock mode, didn't want to do a real execution, but maybe that's better?

@@ -16,7 +15,6 @@ export type CommandBarContext = {
commands: Command[]
selectedCommand?: Command
currentArgument?: CommandArgument<unknown> & { name: string }
selectionRanges: Selections__old
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looked completely un-used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant