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:
@ -459,10 +459,30 @@ export const FileMachineProvider = ({
|
||||
name: sample.title,
|
||||
})),
|
||||
},
|
||||
specialPropsForInsertCommand: {
|
||||
providedOptions: (isDesktop() && project?.children
|
||||
? project.children
|
||||
: []
|
||||
).flatMap((v) => {
|
||||
// TODO: add support for full tree traversal when KCL support subdir imports
|
||||
const relativeFilePath = v.path.replace(
|
||||
project?.path + window.electron.sep,
|
||||
''
|
||||
)
|
||||
const isDirectory = v.children
|
||||
const isCurrentFile = v.path === file?.path
|
||||
return isDirectory || isCurrentFile
|
||||
? []
|
||||
: {
|
||||
name: relativeFilePath,
|
||||
value: relativeFilePath,
|
||||
}
|
||||
}),
|
||||
},
|
||||
}).filter(
|
||||
(command) => kclSamples.length || command.name !== 'open-kcl-example'
|
||||
),
|
||||
[codeManager, kclManager, send, kclSamples]
|
||||
[codeManager, kclManager, send, kclSamples, project, file]
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
|
Reference in New Issue
Block a user