Skip to main content

VS Code extension

Autocomplete, hovers, snippets and diagnostics for bootstrap-ng in Angular templates, in Visual Studio Code and other editors that use Open VSX.

Install

Install the extension from either marketplace:

Or install it from the command line:

code --install-extension coliff.bootstrap-ng

Features

The extension works in HTML templates and in inline Angular template strings. Commands, settings, diagnostics and hovers follow the VS Code display language (English and Japanese).

  • Completions for bs* directives, their inputs and outputs, and documented values such as theme.
  • Completions and hovers for Bootstrap 6 classes in class attributes, including responsive variants such as md:col-6.
  • Completions for bootstrap-ng imports.
  • Hovers with a short description and a link to these docs.
  • Snippets for common components and form controls, such as bs-alert, bs-dialog and bs-form-field.
  • Warnings for attribute values outside the documented set, with quick fixes that correct misspelled values.
  • Hints on Bootstrap 5 data-bs-toggle and data-bs-dismiss attributes that name the bootstrap-ng directive to use instead, with quick fixes for tooltips, popovers and close buttons.
  • Warnings when a standalone component's template uses a directive it doesn't import, with a quick fix that adds the import.
  • A Bootstrap-ng: Open Documentation command that opens the docs for the symbol under the cursor.

Settings

All diagnostics are on by default. Turn them off in your VS Code settings:

SettingDescription
bootstrap-ng.validateAttributeValuesWarns about unknown static attribute values.
bootstrap-ng.hintBootstrap5DataApiHints about Bootstrap 5 data-bs-* attributes.
bootstrap-ng.validateImportsWarns when a template uses a directive that its component doesn't import.

To add missing imports to inline templates when you save, add this to your settings:

{
  "editor.codeActionsOnSave": {
    "source.fixAll.bootstrap-ng": "explicit"
  }
}

Source code

The extension is open source. Report issues and contribute on GitHub.