- Notifications
You must be signed in to change notification settings - Fork2
Laravel extension for coc.nvim
License
yaegassy/coc-laravel
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Laravel extension forcoc.nvim.
CocInstall:
:CocInstall@yaegassy/coc-laravel
scoped packages
vim-plug:
Plug'yaegassy/coc-laravel', {'do':'yarn install --frozen-lockfile'}
Note:
This coc-extension executesartisan commands in the background for some features. Therefore, you must be able to runPHP in your environment.
This coc-extension will provide various completion features and more features for Laravel projects.
- Completions
- Component completion |DEMO
- Livewire completion (Also compatible with Livewire
v3!) - PHP completion in PHP-related region of Blade file
- [NOTE]: To use this feature, please execute the
laravel.stubs.downloadcommand. - PHP Function completion |DEMO
- PHP Class completion |DEMO
- PHP Static Class completion (Static class members and constants, e.g.
DateTime::|) |DEMO - PHP Object Member completion (e.g.
$obj->|) |DEMO - PHP Variable completion |DEMO
- PHP Constant completion |DESCRIPTION
- PHP Keyword completion |DESCRIPTION
- [NOTE]: To use this feature, please execute the
- Directive completion |DEMO
- Config completion |DEMO
- Env completion |DEMO
- Validation completion |DEMO
- Route completion |DEMO
- View completion |DEMO
- Middleware completion |DEMO
- Guard completion |DEMO
- Translation completion |DEMO
- Method directive parameter completion |DEMO
- View reference variable completion |DEMO
- Eloquent model field completion |DEMO
- Completion feature using
_ide_helper_models.phpfile generated bylaravel-ide-helper
- Completion feature using
- Misc
- Definitions
- View definition |DEMO
- [PHP -> Blade] Definition jump to the Blade template specified by the view() function.
- Blade View definition |DEMO
- [Blade -> Blade] Jump to the Blade template specified by the
@extendsand@includedirectives.
- [Blade -> Blade] Jump to the Blade template specified by the
- Component definition |DEMO
- [Blade -> PHP or Blade] Jump to the component file. Both class components and anonymous components are supported.
- Livewire tag definition |DEMO
- [Blade -> PHP or Blade] Jump to the livewire file. Both livewire class and blade template are supported.
- Livewire directive definition |DEMO
- [Blade -> PHP or Blade] Jump to the livewire file. Both livewire class and blade template are supported.
- View definition |DEMO
- References
laravel.view.findAllReferencescommand |DEMO- [Blade -> PHP] Show references to PHP files that use the current bladefile. Referenced directories are
routes,app/Http/Controllers,app/View/Components,app/Http/Livewireandapp/Livewire.
- [Blade -> PHP] Show references to PHP files that use the current bladefile. Referenced directories are
- View reference |DEMO
- [PHP -> Blade] Reference to a PHP file that uses the same template in the view function.
- Hovers
- ComponentTag Hover |DEMO
- Diagnostics
- CodeActions
- Artisan and Sail commands integration
laravel.artisan.runcommand feature.laravel.sailArtisan.runcommand feature.
coc-laravel uses theworkspace/didChangeWatchedFiles notification to monitor files in the project.
In coc.nvim, it is recommended to installwatchman in order to utilize this feature.
If you have difficulty installingwatchman, you can usecoc-laravel withoutwatchman, but you may not be able to immediately use IntelliSense with the newly added files.
In this case, please manually enter the following command.
:CocCommand laravel.project.restart
or
:CocRestart
Depending on the project like mono repo or how Vim/Neovim is started,workspaceFolders may not be recognized correctly.
To make coc.nvim recognizeworkspaceFolders correctly, you can setb:coc_root_patterns in .vimrc/init.vim
Example:
auFileTypephp,bladeletb:coc_root_patterns= ['.git','.env','composer.json','artisan']
For more information, check this coc.nvim's wiki.
laravel.enable: Enable coc-laravel extension, default:truelaravel.environment.phpPath: Path to PHP, you can use a custom version of PHP. If there is no setting,phpof the execution environment will be used, default:""laravel.project.excludeVendors: List of target vendor directories to exclude during project analysis, e.g.["fakerphp", "phpunit"], default:[]laravel.project.startupMessageEnable: Enable project startup messages, default:truelaravel.stubs.customVersion: Specify the version of stubs to download with thelaravel.stubs.downloadcommand. If not set, thestubsVersiondefined inpackage.jsonwill be used, default:""laravel.stubs.useStubs: List of stubs to be used, default:["Core", "date", "standard"]laravel.completion.enable: Enable all completion feature, default:truelaravel.completion.directiveEnable: Enable directive completion, default:truelaravel.completion.directiveList: List of directive used in directive completion, default: Omitted due to the large number of settings, See configuration inpackage.jsonlaravel.completion.configEnable: Enable config completion, default:truelaravel.completion.envEnable: Enable env completion, default: truelaravel.completion.validationEnable: Enable validation completion.laravel.completion.routeEnable: Enable route completion, default:truelaravel.completion.viewEnable: Enable view completion, default:truelaravel.completion.middlewareEnable: Enable middleware completion, default:truelaravel.completion.guardEnable: Enable guard completion, default:truelaravel.completion.translationEnable: Enable translation completion, default:truelaravel.completion.componentEnable: Enable component completion, default:truelaravel.completion.phpFunctionEnable: Enable php function completion, default:truelaravel.completion.phpFunction.stubsEnable: Enable stubs in phpFunction completion, default:truelaravel.completion.phpFunction.vendorEnable: Enable vendor in phpFunction completion, default:truelaravel.completion.phpClassEnable: Enable php class completion, default:truelaravel.completion.phpClass.stubsEnable: Enable stubs in phpClass completion, default:truelaravel.completion.phpClass.vendorEnable: Enable vendor in phpClass completion, default:truelaravel.completion.phpConstantEnable: Enable php constant completion, default:truelaravel.completion.phpConstant.stubsEnable: Enable stubs in phpConstant completion, default:truelaravel.completion.phpConstant.vendorEnable: Enable vendor in phpConstant completion, default:truelaravel.completion.phpStaticClassEnable: Enable php static class completion, default:truelaravel.completion.phpObjectMemberEnable: Enable php object member completion, default:truelaravel.completion.phpVariableEnable: Enable php variable completion, default:truelaravel.completion.phpKeywordEnable: Enable php keyword completion, default:truelaravel.completion.eloquentModelFieldEnable: Enable eloquent model field completion, default:truelaravel.completion.viewReferenceVariableEnable: Enable view reference variable completion, default:truelaravel.completion.methodParameterEnable: Enable method parameter completion, default:truelaravel.completion.livewireEnable: Enable livewire completion, default:truelaravel.livewire.wireClickAttributes: List of click related action to be added towire:xxxx, default:["click", "click.prefetch"]laravel.livewire.wireModelAttributes: List of model related action to be added towire:xxxx, default:["model", "model.debounce.100ms", "model.lazy", "model.defer"]laravel.livewire.wireEventAttributes: List of browser events to be added towire:xxxx. No need forwire:modelorwire:click. default: Omitted due to the large number of settings, See configuration inpackage.jsonlaravel.definition.enable: Enable definition, defaulttruelaravel.reference.enable: Enable reference, defaulttruelaravel.hover.enable: Enable hover, defaulttruelaravel.diagnostic.enable: Enable diagnostic, default:truelaravel.codeAction.enable: Enable code action, default:truelaravel.artisan.withoutArgumentsCommandList: List of commands to quickly executelaravel.artisan.runorlaravel.sailArtisan.runwithout prompting for arguments or options, e.g.["route:list", "clear-compiled"], default:[]laravel.artisan.enableSplitRight: Use vertical belowright for artisan terminal window, default:false
laravel.project.restart: Run project restartlaravel.project.stats: (Develop) Show project statslaravel.project.finder: (Develop) Run project finderlaravel.stubs.download: Download stubslaravel.stubs.version: Show the version of stubslaravel.artisan.run: Run artisan commandlaravel.sailArtisan.run: Run sail artisan commandlaravel.view.findAllReferences: Find view file referenceslaravel.showOutput: Show laravel output channel
Example key mapping (Code Action related):
nmap<silent>ga<Plug>(coc-codeaction-line)nmap<silent><leader>ac<Plug>(coc-codeaction-cursor)
Actions:
Create blade componentFix method directive parameter
- amir9480/vscode-laravel-extra-intellisense | (VSCode extension)
- Laravel Idea | (PhpStorm plugin)
- haringsrob/laravel-dev-tools
- and More...
- glayzzle/php-parser
- Stillat/blade-parser-typescript
- JetBrains/phpstorm-stubs
- microsoft/vscode-html-languageservice
MIT
This extension is built withcreate-coc-extension
About
Laravel extension for coc.nvim
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.