Skip to content

Move closest helper into core and rewire imports#9040

Open
Copilot wants to merge 4 commits intomasterfrom
copilot/change-find-closest-atom-usage
Open

Move closest helper into core and rewire imports#9040
Copilot wants to merge 4 commits intomasterfrom
copilot/change-find-closest-atom-usage

Conversation

Copy link
Contributor

Copilot AI commented Jan 26, 2026

How the feature works? / How did you fix the issue?

  • Summarized issue: consolidate findClosestAtom/closest utilities into ketcher-core, remove duplicate React copy, and update all call sites.
  • Changes:
    • Ported closest.ts and its types into packages/ketcher-core/src/application/editor/shared, exporting via core index (including default closest).
    • Removed legacy core closest.js and the React copy of closest.ts; React now consumes the core implementation and types.
    • Updated React imports (editor, tools, utils) to pull closest/ClosestItem* from core; adjusted context menu type comment.

Example usage after change:

import { closest, ClosestItemWithMap } from 'ketcher-core';

const hit = closest.item(restruct, pos, ['atoms'], skip, options);

Check list

  • unit-tests written
  • e2e-tests written
  • documentation updated
  • PR name follows the pattern #1234 – issue name
  • branch name doesn't contain '#'
  • PR is linked with the issue
  • base branch (master or release/xx) is correct
  • task status changed to "Code review"
  • reviewers are notified about the pull request
Original prompt

This section details on the original issue you should resolve

<issue_title>Change all usages of findClosestAtom function from packages\ketcher-core\src\application\editor\shared\closest.js to usage of findClosestAtom function from packages\ketcher-react\src\script\editor\shared\closest.ts</issue_title>
<issue_description>1. Change all usages of findClosestAtom function from packages\ketcher-core\src\application\editor\shared\closest.js to usage of findClosestAtom function from packages\ketcher-react\src\script\editor\shared\closest.ts
2. Remove packages\ketcher-core\src\application\editor\shared\closest.js file afterwards
3. Rather than having closest.ts in ketcher-react we should move it to ketcher-core and readjust all the import/export expressions related to that</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 26, 2026 22:02
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Copilot AI changed the title [WIP] Update findClosestAtom function references and move file Move closest helper into core and rewire imports Jan 26, 2026
Copilot AI requested a review from AlexeyGirin January 26, 2026 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants