Skip to content

Fix component and view discovery fails with symlinked packages outside project directory#603

Draft
N1ebieski wants to merge 1 commit intolaravel:mainfrom
N1ebieski:#92-Fix-component-and-view-discovery-fails-with-symlinked-packages-outside-project-directory
Draft

Fix component and view discovery fails with symlinked packages outside project directory#603
N1ebieski wants to merge 1 commit intolaravel:mainfrom
N1ebieski:#92-Fix-component-and-view-discovery-fails-with-symlinked-packages-outside-project-directory

Conversation

@N1ebieski
Copy link
Contributor

Fixes #575

Current behaviour

LaravelVsCode::relativePath generates a relative path by removing the Laravel project's basePath from the given path. However, if the path does not contain the basePath (for example, when it points to a location outside the project directory), the result is the absolute path within the repository for that view/component.

My proposition

As a fallback in this situation, LaravelVsCode::relativePath could use another method based on segment comparison.

Windows example:

BasePath: D:\Work\livewire-starter-kit

ViewPath: D:\Work\packages\author-name\package-name\resources\views\hello.blade.php

D:\Work is the common part, so it can be removed. The livewire-starter-kit segment is missing in the view path, which means we need to go up one level (..).

The final relative path would be:

..\packages\author-name\package-name\resources\views\hello.blade.php

@TitasGailius
Copy link
Collaborator

Hey @N1ebieski, this is a great start.

I think there is definitely a pathway for the extension to work with symlinked packages, but I'm not 100% sold on this specific approach just yet. I'd like to dive into a bit more research before we move forward with this.

@TitasGailius TitasGailius marked this pull request as draft March 11, 2026 17:48
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.

Component discovery fails with symlinked packages outside project directory

2 participants