coc-htmldjango
yaegassydjango templates (htmldjango) extension for coc.nvim. Provides formatter, snippets completion and more...
Published Package Summary
coc-htmldjango
django templates (htmldjango) extension for coc.nvim. Provides "formatter", "linter", "completion" and more...
Features
- Format
- Lint
- Completion
- Completion of snippets data via
completionItemProvider
- Completion of snippets data via
- Hover | DEMO
- CodeAction | DEMO
- Commands
- Built-in installer (djLint, DjHTML)
Install
CocInstall:
:CocInstall coc-htmldjango
vim-plug:
Plug 'yaegassy/coc-htmldjango', {'do': 'yarn install --frozen-lockfile'}
Recommended coc-extensions to install together
Tool (linter & formatter) detection
Detection order:
htmldjango.djlint.commandPathandhtmldjango.djhtml.commandPathsettings- current python environment (e.g.
djlintanddjhtmlin "venv") - builtin
djlintanddjhtml(Installation commands are also provided)
Code Actions
Example key mapping (Code Action related):
nmap <silent> ga <Plug>(coc-codeaction-line)
Actions:
- If
htmldjango.formatting.providerisdjlintor Ifhtmldjango.djlint.enableLintistrue - If
htmldjango.formatting.providerisdjhtmlAdd {# fmt:off #} for this lineAdd {# fmt:on #} for this line
Bult-in install (djLint, DjHTML)
coc-htmldjango allows you to create an extension-only "venv" and install "djlint" and "djhtml".
:CocCommand htmldjango.builtin.installTools
Thanks
License
MIT
This extension is built with create-coc-extension
- django templates (htmldjango) extension for coc.nvim. Provides formatter, snippets completion and more...
- onLanguage:htmldjango
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 coc-htmldjango@0.14.23.
| Command (:CocCommand) | Description |
|---|---|
| htmldjango.showOutput | Show htmldjango output channel |
| htmldjango.builtin.installTools | Install htmldjango related tools |
| htmldjango.djlint.format | Run djLint format |
| htmldjango.djhtml.format | Run DjHTML format |
| htmldjango.showReferences | Show Variables Block (`{{ ... }}`) or TemplateTags Block (`{% ... %}`) location information for the current file |
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-htmldjango extension"
}Raw JSON Schema
{
"enum": [
"django",
"jinja2"
],
"type": "string",
"default": "django",
"description": "Set the template language to be used for the hover"
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Codes to ignore (--ignore)"
}Raw JSON Schema
{
"type": "number",
"default": 4,
"description": "Indent spacing (--indent)"
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Codes to include (--include)"
}Raw JSON Schema
{
"enum": [
"html",
"django",
"jinja",
"nunjucks",
"handlebars",
"golang",
"angular"
],
"type": "string",
"default": "django",
"description": "Enable defaults by template language (--profile). ops: django, jinja, nunjucks, handlebars, golang"
}Raw JSON Schema
{
"type": "number",
"default": 4,
"description": "Set tabwidth (--tabwidth)"
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Also format contents of <script> tags (--format-js)"
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Also format contents of <style> tags (--format-css)"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable snippets completion"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable djLint lint (diagnostics)"
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Do not fix case on known html tags (--ignore-case)"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Lint file on opening"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Lint file on save"
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Python 3.x path (Absolute path) to be used for built-in install"
}Raw JSON Schema
{
"type": "array",
"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",
"translate_paste",
"blocktranslate_paste",
"blocktranslate_with_paste"
],
"description": "Exclude specific key in snippet completion"
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "The custom path to the djhtml (Absolute path)."
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "The custom path to the djlint (Absolute path)."
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Comma list of template blocks to not indent (--ignore-blocks)"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Lint file on change"
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Use .gitignore file to extend excludes (--use-gitignore)"
}Raw JSON Schema
{
"enum": [
"djlint",
"djhtml",
"none"
],
"type": "string",
"default": "djlint",
"description": "Provider for formatting. Possible options include 'djlint', 'djhtml' and 'none'"
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Additional arguments passed to djlint linter"
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Additional arguments passed to djlint formatter"
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Attempt to preserve blank lines (--preserve-blank-lines)"
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Attempt to preserve leading space on text (--preserve-leading-space)"
}