coc-blade

    0.3.0 • Public • Published

    coc-blade

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

    coc-blade-demo

    Features

    • Format
      • by blade-formatter (An opinionated blade template formatter for Laravel that respects readability)
    • Lint
    • Completion
      • Completion of snippets data via completionItemProvider
    • Definition
      • Jump to template file specified by @extends, @include directive, etc.
      • Jump to "Blade Components" file.
        • [Warning] Class-based Blade Components are not supported.
    • Hover

    Install

    CocInstall:

    :CocInstall coc-blade

    vim-plug:

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

    Recommended coc extension:

    Note

    Filetype related

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

    Set up autocmd BufNewFile,BufRead *.blade.php set filetype=blade in .vimrc/init.vim, Or install "blade" related plugin (e.g. jwalton512/vim-blade or sheerun/vim-polyglot).

    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.

    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/**/*

    Auto-run on save is not recommended:

    blade-formatter is slow, we do not recommend that you set it to auto-execute on save. If you set up blade-formatter to auto-execute on save, the process may not be completed normally.

    linter (laravel-blade-linter)

    You will need to have laravel-blade-linter installed in your "Laravel project".

    If "laravel-blade-linter" is not detected, the lint (diagnostics) feature is automatically disabled.

    composer require --dev bdelespierre/laravel-blade-linter

    Configuration options

    • blade.enable: Enable coc-blade extension, default: true
    • blade.completion.enable: Enable snippets completion, default: true
    • blade.completion.exclude: Exclude specific prefix in snippet completion, e.g. ["b:extends", "lv:url", "Blade::component"], default: []
    • blade.bladeFormatter.enable: Enable/Disable the formatting feature by blade-formatter, default: true
    • blade.bladeFormatter.toolPath: Absolute path to blade-formatter. If there is no setting, the built-in blade-formatter will be used, default: ""
    • blade.bladeFormatter.optIndentSize: Indent size (--indent-size), default: 4
    • blade.bladeFormatter.optWrapLineLength: The length of line wrap size (--wrap-line-length), default: 120
    • blade.bladeFormatter.optWrapAttributes: The way to wrap attributes (--wrap-attributes), valid options ["auto", "force", "force-aligned", "force-expand-multiline", "aligned-multiple", "preserve", "preserve-aligned"], default: "auto"
    • blade.bladeLinter.enable: Enable/Disable the linting feature by laravel-blade-linter, default: true

    Commands

    • blade.bladeFormatter.run: Run blade-formatter

    Thanks

    License

    MIT


    This extension is built with create-coc-extension

    Install

    npm i coc-blade

    DownloadsWeekly Downloads

    111

    Version

    0.3.0

    License

    MIT

    Unpacked Size

    67.2 kB

    Total Files

    54

    Last publish

    Collaborators

    • yaegassy