coc-htmldjango

    0.8.17 • Public • Published

    coc-htmldjango

    django templates (htmldjango) extension for coc.nvim. Provides "formatter", "linter", "completion" and more...

    coc-htmldjango-demo

    Features

    • Format
      • by DjHTML ("Django/Jinja" template indenter) | DEMO
      • by djLint (reformat HTML templates)
    • Lint (default: false)
      • by djLint (Find common formatting issues) | DEMO
    • Completion
      • Completion of snippets data via completionItemProvider
    • Hover | DEMO
    • CodeAction | DEMO
    • Built-in installer (DjHTML, djLint)

    Install

    CocInstall:

    :CocInstall coc-htmldjango

    vim-plug:

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

    Recommended coc extension:

    Tool (linter & formatter) detection

    Detection order:

    • htmldjango.djhtml.commandPath and htmldjango.djlint.commandPath settings
    • current python environment (e.g. djhtml and djlint in "venv")
    • builtin djhtml and djlint (Installation commands are also provided)

    Configuration options for coc-htmldjango

    • htmldjango.enable: Enable coc-htmldjango extension, default: true
    • htmldjango.completion.enable: Enable snippets completion, default: true
    • htmldjango.completion.exclude: Exclude specific key in snippet completion, default: ["autoescape_paste", "comment_paste", "comment_selection", "for_paste", "forempty_paste", "if_paste", "ifelse_paste", "spaceless_paste", "verbatim_paste", "with_selection", "with_paste", "trans_paste", "blocktrans_paste", "blocktrans_with_paste"]
    • htmldjango.builtin.pythonPath: Python 3.x path (Absolute path) to be used for built-in install, default: ""
    • htmldjango.formatting.provider: Provider for formatting. Possible options include 'djhtml', 'djlint', and 'none', default: "djhtml"
    • htmldjango.djhtml.commandPath: The custom path to the djhtml (Absolute path), default: ""
    • htmldjango.djhtml.tabWidth: Set tabwidth (--tabwidth), default: 4
    • htmldjango.djlint.commandPath: The custom path to the djlint (Absolute path), default: ""
    • htmldjango.djlint.enableLint: Enable djLint lint (diagnostics), default: false
    • htmldjango.djlint.lintOnOpen: Lint file on opening, default: true
    • htmldjango.djlint.lintOnChange: Lint file on change, default: true
    • htmldjango.djlint.lintOnSave: Lint file on save, default: true
    • htmldjango.djlint.ignore: Codes to ignore (--ignore), ex: "W013,W014", default: ""
    • htmldjango.djlint.indent: Indent spacing (--indent), default: 4
    • htmldjango.djlint.profile: Enable defaults by template language. ops: django, jinja, nunjucks, handlebars, golang, default: ["django"]
    • htmldjango.djlint.useGitIgnore: Use .gitignore file to extend excludes (--use-gitignore), default: false

    Commands

    • htmldjango.builtin.installTools
    • htmldjango.djhtml.format
    • htmldjango.djlint.format

    Code Actions

    Example key mapping (Code Action related):

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

    Actions:

    • If htmldjango.formatting.provider is djhtml
      • Add {# fmt:off #} for this line
      • Add {# fmt:on #} for this line
    • If htmldjango.formatting.provider is djlint or If htmldjango.djlint.enableLint is true
      • Add <!-- djlint:off --> for this line
      • Add <!-- djlint:on --> for this line

    Bult-in install (DjHTML, djLint)

    coc-htmldjango allows you to create an extension-only "venv" and install "djhtml" and "djlint".

    :CocComannd htmldjango.builtin.installTools

    Thanks

    License

    MIT


    This extension is built with create-coc-extension

    Install

    npm i coc-htmldjango

    DownloadsWeekly Downloads

    363

    Version

    0.8.17

    License

    MIT

    Unpacked Size

    269 kB

    Total Files

    97

    Last publish

    Collaborators

    • yaegassy