Add point-and-click Insert from local project files (#6129)

* WIP: Add point-and-click Import for geometry
Will eventually fix #6120
Right now the whole loop is there but the codemod doesn't work yet

* Better pathToNOde, log on non-working cm dispatch call

* Add workaround to updateModelingState not working

* Back to updateModelingState with a skip flag

* Better todo

* Change working from Import to Insert, cleanups

* Sister command in kclCommands to populate file options

* Improve path selector

* Unsure: move importAstMod to kclCommands onSubmit 😶

* Add e2e test

* Clean up for review

* Add native file menu entry and test

* No await yo lint said so

* @lrev-Dev's suggestion to remove a comment

Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>

* Update to scene.settled(cmdBar)

* Lint

---------

Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
This commit is contained in:
Pierre Jacquier
2025-04-07 16:28:11 -04:00
committed by GitHub
parent 962eb0e376
commit bc0f5b5787
14 changed files with 400 additions and 9 deletions

View File

@ -113,6 +113,7 @@ function ProjectMenuPopover({
const commands = useSelector(commandBarActor, commandsSelector)
const { onProjectClose } = useLspContext()
const insertCommandInfo = { name: 'Insert', groupId: 'code' }
const exportCommandInfo = { name: 'Export', groupId: 'modeling' }
const makeCommandInfo = { name: 'Make', groupId: 'modeling' }
const shareCommandInfo = { name: 'share-file-link', groupId: 'code' }
@ -145,6 +146,29 @@ function ProjectMenuPopover({
},
},
'break',
{
id: 'insert',
Element: 'button',
children: (
<>
<span>Insert from project file</span>
{!findCommand(insertCommandInfo) && (
<Tooltip
position="right"
wrapperClassName="!max-w-none min-w-fit"
>
Awaiting engine connection
</Tooltip>
)}
</>
),
disabled: !findCommand(insertCommandInfo),
onClick: () =>
commandBarActor.send({
type: 'Find and select command',
data: insertCommandInfo,
}),
},
{
id: 'export',
Element: 'button',