Skip to content

Conversation

@cschmatzler
Copy link
Contributor

findComponent previously used endsWith() - this caused conflicts with my two components Workspace.vue and CreateWorkspace.vue. This PR makes the handling more exact.

Disclaimer: this was mostly debugged and implemented by an LLM - see https://ampcode.com/threads/T-3b8af23a-35e8-45cf-a7b4-6e4b175da0d6

// we're looking for a component by exact filename match
for (const [key, value] of Object.entries(components)) {
if (key.endsWith(`${name}.vue`) || key.endsWith(`${name}/index.vue`)) {
const fileName = key.split('/').pop() // Get the actual filename
Copy link
Owner

Choose a reason for hiding this comment

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

I understand why you've done it, but I can explain the reason for the previous behaviour.

Imagine you have two components, components/workspaces/List.vue and conponents/accounts/List.vue.

With my previous approach, you could type either full path or just last unambigious part. With yours I think it's no longer possible.

But!

I think you can adjust it. Something along the lines to split both candidate and searched component by / and try to match starting from last index.

Would be great if you (or AMP) could do it ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yeah that makes sense. I'll cook something up later that supports both workflows :)

@Valian
Copy link
Owner

Valian commented Sep 29, 2025

Hi @cschmatzler, any updates on this? :)

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.

2 participants