Skip to content

Assemblies: UX improvements around foreign file imports#6159

Merged
pierremtb merged 39 commits intomainfrom
pierremtb/issue6152-UX-improvements-around-foreign-file-imports
Apr 9, 2025
Merged

Assemblies: UX improvements around foreign file imports#6159
pierremtb merged 39 commits intomainfrom
pierremtb/issue6152-UX-improvements-around-foreign-file-imports

Conversation

@pierremtb
Copy link
Contributor

@pierremtb pierremtb commented Apr 4, 2025

Fixes #6152

Makes the interaction with non-KCL files in the context of assemblies easier, as a follow up to the initial PR for point-and-click assemblies

Includes:

  1. a fix to show .step files in the file tree (previously only .stp) through more consistent checks around importable files
  2. a test that inserts foreign files in main.kcl, both .step and .sldprt
  3. an automatically generated default value for local name alias in the insert flow, inluding left digit padding as needed
  4. a change in file tree click on foreign files behavior from kcl wrap to prompt to insert into current file
  5. an update to the deep link kcl wrapper moving the whole-module import pattern from the deprecated import() call. Note: I'm still rather unhappy about the kcl wrapper approach that feels somewhat unintuitive to me at least. I'd rather us loading the file into a new project that we'd prompt the use to save somewhere first. But that's outside of the scope here

Does not include:

Mind the next two stacked PRs as well that will be made available after this one:

Demo:
https://github.com/user-attachments/assets/cca91477-44df-4687-8761-4dc604ceb698

@vercel
Copy link

vercel bot commented Apr 4, 2025

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

Name Status Preview Updated (UTC)
modeling-app ✅ Ready (Inspect) Visit Preview Apr 9, 2025 8:40am

@qa-wolf
Copy link

qa-wolf bot commented Apr 4, 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!

@pierremtb pierremtb changed the base branch from main to pierremtb/issue6120-Add-point-and-click-Import-for-geometry April 4, 2025 20:24
@pierremtb pierremtb changed the title Pierremtb/issue6152-UX-improvements-around-foreign-file-imports WIP: UX improvements around foreign file imports Apr 4, 2025
@codecov
Copy link

codecov bot commented Apr 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.01%. Comparing base (ae9d8be) to head (cf34a9d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6159      +/-   ##
==========================================
- Coverage   85.03%   85.01%   -0.03%     
==========================================
  Files         109      109              
  Lines       44758    44758              
==========================================
- Hits        38062    38050      -12     
- Misses       6696     6708      +12     
Flag Coverage Δ
rust 85.01% <ø> (-0.03%) ⬇️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

pierremtb and others added 4 commits April 7, 2025 08:37
Thanks @Irev-Dev for the suggestion
@pierremtb pierremtb changed the title WIP: UX improvements around foreign file imports UX improvements around foreign file imports Apr 7, 2025
@pierremtb pierremtb changed the title UX improvements around foreign file imports Assemblies: UX improvements around foreign file imports Apr 8, 2025
@pierremtb pierremtb marked this pull request as ready for review April 9, 2025 08:24
@pierremtb pierremtb requested a review from a team April 9, 2025 08:24
Copy link
Contributor

@Irev-Dev Irev-Dev left a comment

Choose a reason for hiding this comment

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

Approving because I know this is all behind a DEV flag, so up to you if you want to fix as part of this PR or follow up.

But essentially,

  • When importing an obj (maybe applies to others) I get an error straight away, that is fixed just by causing a re-execute
  • When importing there's no check to see if the local name conflicts with existing variable names.
  • maybe want to test the above when fixed.
Screenshare.-.2025-04-09.9_06_57.PM.mp4

Comment on lines +206 to +207
export const isRelevantFile = (filename: string): boolean =>
RELEVANT_FILE_TYPES.some((ext) => filename.endsWith('.' + ext))
Copy link
Contributor

Choose a reason for hiding this comment

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

You will probably have a conflict with
#6211

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oooh nice appreciate the heads up. Will get it updated to match in a follow up once it lands!

return sourceRange[2]
}

export function getInVariableCase(name: string, prefixIfDigit = 'm') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice.

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't really understand the name though, the in in particular.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha yeah, maybe getStringInVariableCase? I'll think of a better name

@pierremtb
Copy link
Contributor Author

Nice thanks a bunch @Irev-Dev!

When importing an obj (maybe applies to others) I get an error straight away, that is fixed just by causing a re-execute

pretty certain this is related to #5780. will do more testing

When importing there's no check to see if the local name conflicts with existing variable names.

that's a great gotcha thanks for pointing that out

maybe want to test the above when fixed.

yes abosolutely!

I think I will ride the green CI high and merge-as is, will address point 2&3 in a dedicated PR

@pierremtb
Copy link
Contributor Author

Created follow up issue at #6230 under the meta issue

@pierremtb pierremtb merged commit e78100e into main Apr 9, 2025
38 checks passed
@pierremtb pierremtb deleted the pierremtb/issue6152-UX-improvements-around-foreign-file-imports branch April 9, 2025 11:48
modeling-app-github-app bot pushed a commit that referenced this pull request Apr 9, 2025
)

* 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

* WIP: UX improvements around foreign file imports
Fixes #6152

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

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

* Update to scene.settled(cmdBar)

* Add partNNN default name for alias

* Lint

* Lint

* Fix unit tests

* Add sad path insert test
Thanks @Irev-Dev for the suggestion

* Add step insert test

* Lint

* Add test for second foreign import thru file tree click

* Add default value for local name alias

* Aligning tests

* Fix tests

* Add padding for filenames starting with a digit

---------

Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
jacebrowning added a commit that referenced this pull request Apr 9, 2025
* main:
  #4469 Improve toolbar ux (#5841)
  Assemblies: UX improvements around foreign file imports (#6159)
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.

UX improvements around foreign file imports

2 participants