describeBuildCapabilities method

DocumentCapabilities describeBuildCapabilities()

What this build can read, by handler kind.

Names the kinds this document has a handler of, those passed to register and the builtInCapabilities. Builds nothing.

A kind is absent when nothing opened or declared it, which is why a description read off a document is sent as incomplete: silence means "not set up here", not "cannot read".

Throws DocumentDisposedException on a disposed document.

Implementation

DocumentCapabilities describeBuildCapabilities() {
  _ensureNotDisposed('describeBuildCapabilities');

  // Only the specs: a handler declares its kind as it opens, so every kind
  // this document has open is already a key here.
  return DocumentCapabilities({
    ...builtInCapabilities.byHandlerType,
    for (final spec in _registry.specs.values) spec.type: spec.formats,
  });
}