---
description: OAS-UI editor support trio — custom-elements.json (CEM 2.1), full HTMLElementTagNameMap type augmentation, and editor snippets; integration for mainstream code editors / WebStorm / any TS project, plus boundaries.
---

# IDE Support & Editor Tooling

OAS-UI editor support is built on open standards: at build time the [Custom Elements Manifest](https://github.com/webcomponents/custom-elements-manifest) 2.1 listing is generated from the api-manifest (the single source of truth for component APIs) and shipped with the package, along with full `HTMLElementTagNameMap` type augmentation. The editor ecosystem consumes these directly — no custom IDE plugin. Everything activates automatically with the `@oas-ui/ui` dependency; no extra setup steps.

## What the trio is

Produced automatically when building `@oas-ui/ui` (`custom-elements.json` at the package root, the rest inside `dist`; all shipped with the npm package):

- **`custom-elements.json`** (CEM 2.1, package root): every component's tag name, attributes (with types and defaults), events (`CustomEvent`, detail in the description), slots, public properties / methods, and CSS custom properties (standard `cssProperties` field). The package's `customElements` field in `package.json` points to this file so CEM-aware tools can locate it.
- **`tag-names.d.ts`** (inside `dist/types/`, opt-in): full `HTMLElementTagNameMap` augmentation — in TS code, DOM APIs (`createElement` / `querySelector`) return the component classes directly, and class properties (like `el.value`, `el.focus()`) get type checking and completion. It is NOT wired into the types entry by default: a global tag map conflicts with monorepo src/dist dual declarations and with global augmentations from other WC libraries in consumer projects — enabling it takes one reference line, see "Type augmentation (opt-in)" below.
- **`.vscode/oas-ui.code-snippets`** (repo root): snippets for common components (see "Editor snippets" below).

Source and artifacts share one origin: `scripts/ide/generate.mjs` runs automatically at the end of the `@oas-ui/ui` build, reading `docs/api-manifest/*.json` (the same data behind the docs API tables), and CI guards drift byte-for-byte with `--check` — after a component API change just rebuild; there is never a second source of truth between docs and editors.

## Mainstream code editors (extension channel: template completion)

Install a language-server extension that reads CEM listings (such as custom-elements-language-server — an open-source LSP installable in mainstream code editors); it reads the `custom-elements.json` referenced by the `customElements` field in `package.json` and provides tag and attribute completion for HTML / Vue templates. If the extension fails to discover the listing automatically, point its settings at the in-package path manually.

> Note: the CEM listing **cannot** be fed directly to the editor's `html.customData` setting — that is a different custom data format (different JSON shape); copying it there produces no completion. Use an extension that explicitly supports CEM.

### Type augmentation channel (DOM API return types)

## Type augmentation (opt-in, TS / Vue)
Add one line `/// <reference types="@oas-ui/ui/tag-names" />` to a d.ts in your project (or include it via tsconfig `files`) to enable — then `document.createElement('oas-button')` and `querySelector('oas-button')` return the `OASButton` component type directly, and class properties (like `el.value`, `el.focus()`) get type checking and completion. **Not active with the dependency by default**: a global tag map conflicts with monorepo src/dist dual declarations and with global augmentations from other WC libraries in consumer projects — explicit opt-in is the common WC practice. Verified boundary: DOM API return types + class property type checking; template attribute-name checking requires a language-server plugin (the two channels complement each other).

**Boundary**: the `HTMLElementTagNameMap` augmentation does not reach attribute-name validation inside HTML / Vue templates (in-template attribute spelling checks require a language-server extension — that is the previous channel's job); the two channels complement each other.

## WebStorm / JetBrains

JetBrains IDEs natively complete Web Components via their own **web-types** format (this package does not ship web-types.json yet); consuming the CEM listing requires a third-party language-server extension (such as the JetBrains build of custom-elements-language-server) configured as described above. Having `@oas-ui/ui` as a dependency plus the extension is enough.

## Editor snippets

The repo-root `.vscode/oas-ui.code-snippets` provides 13 common component snippets (button / input / select / checkbox / switch / rate / date-picker / modal / drawer / tooltip / table / tabs / message), each with common attribute placeholders and default hints; attribute names are aligned with each component's manifest. They are available automatically when sharing this repository; copy them to your user snippets folder for global use.

## Boundaries

- **CEM coverage = api-manifest fields**: attributes / events / slots / properties / methods / CSS custom properties (`cssProperties`).
- **Parts are not produced yet**: the api-manifest data source does not include parts (component `part` lists are documented on each component's docs page; the the CEM schema itself has that standard field, so once the data lands it can be adopted without structural changes).
- **No in-house IDE plugin** (decision record): the CEM open-standard channel already covers completion; there is no precedent of component libraries shipping their own IDE plugins in the WC ecosystem, and the maintenance cost / ecosystem-compatibility risk is not justified.
- **DevTools inspector** (recorded as an alternative, not built): a component state inspector will only be scoped when real debugging pain appears.
- **Width and other CSS-side customization** is not expanded item-by-item within CEM consumption — see each component's docs page "CSS variables" section (`cssProperties` is structured into the listing for programmatic consumption).
- **`--check` drift guard**: in CI, `node scripts/ide/generate.mjs --check` compares the generated artifacts byte-for-byte and locks the committed state of the listing via `git diff` (after changing the manifest you must commit the regenerated `custom-elements.json`); after a component API change refresh locally with `pnpm build` (or run the generator directly).
