Description
At VS Code, we has been sourcing data from MDN to get up-to-date documentation and compatibility info. One example is: https://code.visualstudio.com/updates/v1_25#_new-css-pseudo-selectors-and-pseudo-elements-from-mdn, and more details are at:
- Use MDN data to power the CSS language server vscode-css-languageservice#68
- Use MDN data to power auto completion in editors through Language Server Protocol mdn/data#199
While chatting with @atopal last week, we thought it would be a great idea to make TypeScript source some documentation from MDN for a better auto-completion experience for JS/TS developers. For example, here is how DOM auto-completion looks like today:
The problem is that lib.dom.d.ts
does not contain description for probably 95% of the items. Users would be at a loss to know what each API offers and how to use them.
MDN currently offers an API to pull description for a specific endpoint. For example, this is the JSON API for DOMParser
: https://developer.mozilla.org/en-US/docs/Web/API/DOMParser$json
The summary
field is (once we remove the HTML and extract text):
The DOMParser interface provides the ability to parse XML or HTML source code from a string into a DOM Document.
It would be great if TypeScript could query MDN for each API without description and put the descriptions into lib.dom.d.ts
, so that users could get much better auto-completion for DOM API.
From MDN side, they are also working on making MDN data more easily accessible by tooling: See https://discourse.mozilla.org/t/proposal-including-css-short-descriptions-in-mdn-data/30500.
/cc @atopal