Skip to main content
Back to Extensions Directory
coc.nvim fallback icon

coc-blade

yaegassy

Laravel Blade Templates extension for coc.nvim

Installation CommandVim prompt
:CocInstall coc-blade
GitHub owner
yaegassy
Version
v0.18.11
npm package
coc-blade
Requirements
coc ^0.0.80
License
MIT
Repository
GitHub
npm latest published 2024-03-20Registry checked 2026-08-23Registry summary

Published Package Summary

coc-blade

Laravel Blade Templates extension for coc.nvim. Provides "formatter", "linter", "completion" and more...

coc-blade-demo

Features

  • Format
  • Lint
  • Completion
    • Blade Snippets Completion
    • Blade Directive Completion
  • Definition
    • Jump to template file specified by @extends, @include directive, etc.
    • Jump to "Blade Components" file.
      • [Warning] Class-based Components are not supported.
    • Jump to "Jetstream Components" file.
  • Code Action
    • Add a blade comment to disable the formatting.
  • Hover

Install

CocInstall:

:CocInstall coc-blade

vim-plug:

Plug 'yaegassy/coc-blade', {'do': 'yarn install --frozen-lockfile'}

Recommended coc extension:

(Optional) Additional installation of laravel blade related coc-extension

  • @yaegassy/coc-laravel
    • Various completions, definitions, references, hovers, diagnostics, codeActions, artisan and sail commands integration and more features for Laravel projects.
  • @yaegassy/coc-intelephense
    • intelephense (PHP language server) extension for coc.nvim. intelephense's various LSP features and this extension's additional features are available.
  • coc-html
    • html-related support will be added in blade

Note

Filetype related

The "filetype" must be blade for this extension to work.

Install "blade" related plugin (e.g. jwalton512/vim-blade or sheerun/vim-polyglot or nvim-treesitter with tree-sitter-blade).

For more information on setup tree-sitter-blade in nvim-treesitter, please click here.

Usage Topics

formatter (blade-formatter)

Run:

  • :call CocAction('format')
  • :CocCommand bladeFormatter.run

If there is a "syntax error" in the blade template, the formatting will fail.

Configuration file: .bladeformatterrc.json or .bladeformatterrc:

To configure settings per project, put .bladeformatterrc.json or .bladeformatterrc to your project root will blade-formatter treat it as setting files.

Configuration file will like below:

{
    "indentSize": 4,
    "wrapAttributes": "auto",
    "wrapLineLength": 120,
    "endWithNewLine": true,
    "useTabs": false,
    "sortTailwindcssClasses": true
}

Ignoring Files: .bladeignore:

To ignore specific file, put .bladeignore to your repository root will blade-formatter treat it as ignored files.

resources/views/users/index.blade.php
resources/views/products/*
resources/views/books/**/*

Disabling format in file:

In coc-blade, there is a code action feature to add a blade comment to disable the formatting.

linter (using Stillat/blade-parser-typescript)

This feature is enabled by default. If you do not need the linter feature, set blade.bladeParserLint.enable to false

snippets completion (laravel-blade-snippets-vscode)

You can auto-complete by typing b:, lv:, Blade::, livewire::.

It uses snippet files from onecentlin/laravel-blade-snippets-vscode to provide completion.

directive completion

You can auto-complete by typing @.

Code Actions

Example key mapping (Code Action related):

nmap <silent> ga <Plug>(coc-codeaction-line)
nmap <silent> gA <Plug>(coc-codeaction)

Actions:

  • Add "blade-formatter-disable-next-line" for this line
  • Add "blade-formatter-disable" for this line
  • Add "blade-formatter-enable" for this line
  • Add "blade-formatter-disable" for whole file

Thanks

License

MIT


This extension is built with create-coc-extension

Read the complete README
  • Laravel Blade Templates extension for coc.nvim
Activation Events
  • onLanguage:blade
Developer Resources

Want to build, test, or contribute to coc.nvim extensions? Explore our official SDK and testing toolkits.

Open Developer Guide

Version 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.