Skip to content

Auto refactor Blade/Livewire component namespaces#634

Open
N1ebieski wants to merge 31 commits into
laravel:mainfrom
N1ebieski:#98-Auto-refactor-BladeLivewire-component-namespace
Open

Auto refactor Blade/Livewire component namespaces#634
N1ebieski wants to merge 31 commits into
laravel:mainfrom
N1ebieski:#98-Auto-refactor-BladeLivewire-component-namespace

Conversation

@N1ebieski

@N1ebieski N1ebieski commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

This PR adds automatic refactoring of Blade/Livewire component namespaces in every view file when:

  • a component file is renamed
  • a component folder is added
  • a component file is moved to another folder

from within the VS Code Explorer.

Nagrywanie.ekranu.2026-04-08.213713.mp4

Roadmap

General

  • Create a new RenameFilesProvider

Respositories

  • Support for Blade components
  • Support for Blade class components
    • Changing a class namespace should update the component view file
    • Changing a class namespace should update the view path in the render method
  • Support for Livewire SFC/MFC components
  • Support for Livewire class components
    • Changing a class namespace should update the component view file
    • Changing a class namespace should update the view path in the render method

Other

Testing

  • Write some VSCode tests

Summary

Hey @TitasGailius, this PR is ready for review. Some details:

  • Drag & drop for Blade/Livewire class components requires manually updating the class namespace after dropping. It might be a good idea in the future (maybe via a framework-agnostic provider) to automatically refactor PHP class namespaces/imports in other PHP files
  • If you use Intelephense or another PHP intelligence plugin, the Blade/Livewire class component can also be refactored by pressing F2 on the classname
  • I tested this feature manually on Windows and Linux. macOS testing is still needed
  • The performance is satisfactory. I tested the feature in one of my projects with hundreds of Blade components, and it worked very well. However, I think it would be better to replace vscode.workspace.findFiles with grep or something similar, because the VS Code team has still not implemented findTextInFiles in the stable version
  • I wrote VS Code tests for Blade components using your laravel-react fixture. To test Livewire components, I would need to install the livewire package. Let me know if you’d like me to do that
  • Support for multi-root workspaces is still pending. I’ll prepare a separate PR for this if this PR is accepted.

…tory' into #98-Auto-refactor-BladeLivewire-component-namespace
…e-repository' into #98-Auto-refactor-BladeLivewire-component-namespace"

This reverts commit b3cc99f, reversing
changes made to ef0fca8.
@N1ebieski N1ebieski marked this pull request as ready for review April 15, 2026 10:24
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.

1 participant