@yaegassy/coc-laravel
yaegassyLaravel extension for coc.nvim
Published Package Summary
coc-laravel
Laravel extension for coc.nvim.
Install
CocInstall:
:CocInstall @yaegassy/coc-laravel
scoped packages
vim-plug:
Plug 'yaegassy/coc-laravel', {'do': 'yarn install --frozen-lockfile'}
Features
Note:
This coc-extension executes artisan commands in the background for some features. Therefore, you must be able to run PHP 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 by laravel-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 blade
file. 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 blade
file. 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.
[RECOMMENDED] Additional installation of "watchman"
coc-laravel uses the workspace/didChangeWatchedFiles notification to monitor files in the project.
In coc.nvim, it is recommended to install watchman in order to utilize this feature.
If you have difficulty installing watchman, you can use coc-laravel without watchman, 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
workspaceFolders
Depending on the project like mono repo or how Vim/Neovim is started, workspaceFolders may not be recognized correctly.
To make coc.nvim recognize workspaceFolders correctly, you can set b:coc_root_patterns in .vimrc/init.vim
Example:
au FileType php,blade let b:coc_root_patterns = ['.git', '.env', 'composer.json', 'artisan']
For more information, check this coc.nvim's wiki.
CodeActions
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
Recommended coc-extensions for php
Inspired Projects
- amir9480/vscode-laravel-extra-intellisense | (VSCode extension)
- Laravel Idea | (PhpStorm plugin)
- haringsrob/laravel-dev-tools
- and More...
Thanks
- glayzzle/php-parser
- Stillat/blade-parser-typescript
- JetBrains/phpstorm-stubs
- microsoft/vscode-html-languageservice
License
MIT
This extension is built with create-coc-extension
- Laravel extension for coc.nvim
- onLanguage:php
- onLanguage:blade
Want to build, test, or contribute to coc.nvim extensions? Explore our official SDK and testing toolkits.
Open Developer GuideVersion History
This published npm package does not include a history.md or changelog.md file. Browse its npm versions or repository releases for available release information.
Contributed Commands
All contributes.commands entries from the published package manifest for @yaegassy/coc-laravel@0.7.18.
| Command (:CocCommand) | Description |
|---|---|
| laravel.project.restart | Run project restart |
| laravel.project.stats | (Develop) Show project stats |
| laravel.project.finder | (Develop) Run project finder |
| laravel.stubs.download | Download stubs |
| laravel.stubs.version | Show the version of stubs |
| laravel.artisan.run | Run artisan command |
| laravel.sailArtisan.run | Run sail artisan command |
| laravel.view.findAllReferences | Find view file references |
| laravel.showOutput | Show laravel output channel |
Configuration Schema
All contributes.configuration entries from the published package manifest, including each raw property schema for coc-settings.json.
Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable coc-laravel extension."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable hover."
}Raw JSON Schema
{
"type": "array",
"default": [
"Core",
"date",
"standard"
],
"description": "List of stubs to be used."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable reference."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable code action."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable definition."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable diagnostic."
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Path to PHP, you can use a custom version of PHP. If there is no setting, `php` of the execution environment will be used."
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Specify the version of stubs to download with the `laravel.stubs.download` command. If not set, the `stubsVersion` defined in `package.json` will be used."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable env completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable view completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable guard completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable route completion."
}Raw JSON Schema
{
"type": "array",
"default": [],
"description": "List of target vendor directories to exclude during project analysis, e.g. [\"fakerphp\", \"phpunit\"]"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable config completion."
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Use vertical belowright for artisan terminal window."
}Raw JSON Schema
{
"type": "array",
"default": [
"@extends",
"@yield",
"@section",
"@endsection",
"@show",
"@include",
"@if",
"@endif",
"@else",
"@hasSection",
"@unless",
"@endunless",
"@for",
"@endfor",
"@foreach",
"@endforeach",
"@forelse",
"@empty",
"@endforelse",
"@while",
"@endwhile",
"@each",
"@verbatim",
"@endverbatim",
"@push",
"@endpush",
"@stack",
"@inject",
"@can",
"@endcan",
"@elsecan",
"@canany",
"@endcanany",
"@elsecanany",
"@cannot",
"@endcannot",
"@elsecannot",
"@php",
"@endphp",
"@includeIf",
"@component",
"@endcomponent",
"@slot",
"@endslot",
"@isset",
"@endisset",
"@endempty",
"@error",
"@enderror",
"@includeWhen",
"@auth",
"@endauth",
"@guest",
"@endguest",
"@switch",
"@case",
"@break",
"@default",
"@endswitch",
"@includeFirst",
"@csrf",
"@method",
"@dump",
"@dd",
"@lang",
"@includeUnless",
"@props",
"@env",
"@endenv",
"@production",
"@endproduction",
"@once",
"@endonce",
"@aware",
"@js",
"@class",
"@checked",
"@selected",
"@disabled",
"@style",
"@readonly",
"@required",
"@pushOnce",
"@endPushOnce",
"@prepend",
"@prependOnce",
"@endPrependOnce",
"@livewire",
"@livewireStyles",
"@livewireScripts"
],
"description": "List of directive used in directive completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable livewire completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable php class completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable component completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable directive completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable middleware completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable php keyword completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable validation completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable php constant completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable php function completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable php variable completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable translation completion."
}Raw JSON Schema
{
"type": "array",
"default": [
"click",
"click.prefetch",
"submit",
"submit.prevent",
"keydown",
"keydown.enter"
],
"description": "List of click related action to be added to `wire:xxxx`."
}Raw JSON Schema
{
"type": "array",
"default": [
"key",
"poll",
"poll.500ms",
"poll.keep-alive",
"poll.visible",
"init",
"loading",
"loading.class",
"loading.class.remove",
"loading.attr",
"loading.delay",
"loading.delay.shortest",
"loading.delay.shorter",
"loading.delay.short",
"loading.delay.long",
"loading.delay.longer",
"loading.delay.longest",
"dirty",
"dirty.class",
"dirty.class.remove",
"dirty.attr",
"offline",
"offline.class",
"offline.class.remove",
"offline.attr",
"target",
"ignore",
"ignore.self",
"abort",
"afterprint",
"animationend",
"animationiteration",
"animationstart",
"beforeprint",
"beforeunload",
"blur",
"canplay",
"canplaythrough",
"change",
"contextmenu",
"copy",
"cut",
"dblclick",
"drag",
"dragend",
"dragenter",
"dragleave",
"dragover",
"dragstart",
"drop",
"durationchange",
"ended",
"error",
"focus",
"focusin",
"focusout",
"fullscreenchange",
"fullscreenerror",
"hashchange",
"input",
"invalid",
"keypress",
"keyup",
"load",
"loadeddata",
"loadedmetadata",
"loadstart",
"message",
"mousedown",
"mouseenter",
"mouseleave",
"mousemove",
"mouseover",
"mouseout",
"mouseup",
"online",
"open",
"pagehide",
"pageshow",
"paste",
"pause",
"play",
"playing",
"popstate",
"progress",
"ratechange",
"resize",
"reset",
"scroll",
"search",
"seeked",
"seeking",
"select",
"show",
"stalled",
"storage",
"suspend",
"timeupdate",
"toggle",
"touchcancel",
"touchend",
"touchmove",
"touchstart",
"transitionend",
"unload",
"volumechange",
"waiting",
"wheel"
],
"description": "List of browser events to be added to wire:xxxx. No need for wire:model or wire:click."
}Raw JSON Schema
{
"type": "array",
"default": [
"model",
"model.debounce.100ms",
"model.lazy",
"model.defer"
],
"description": "List of model related action to be added to wire:xxxx."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable project startup messages."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable stubs in phpClass completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable method parameter completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable vendor in phpClass completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable php object member completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable stubs in phpConstant completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable stubs in phpFunction completion."
}Raw JSON Schema
{
"type": "array",
"default": [],
"description": "List of commands to quickly execute `laravel.artisan.run` or `laravel.sailArtisan.run` without prompting for arguments or options, e.g. `[\"route:list\", \"clear-compiled\"]`."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable eloquent model field completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable vendor in phpConstant completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable vendor in phpFunction completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable php static class member completion."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable view reference variable completion."
}