Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance DOM API completion by sourcing descriptions from MDN #26404

Closed
octref opened this issue Aug 13, 2018 · 3 comments
Closed

Enhance DOM API completion by sourcing descriptions from MDN #26404

octref opened this issue Aug 13, 2018 · 3 comments
Labels
Help Wanted You can do this Suggestion An idea for TypeScript

Comments

@octref
Copy link

octref commented Aug 13, 2018

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:

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:

image

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

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript In Discussion Not yet reached consensus labels Aug 13, 2018
@RyanCavanaugh RyanCavanaugh added Help Wanted You can do this and removed In Discussion Not yet reached consensus labels Aug 23, 2018
@RyanCavanaugh RyanCavanaugh added this to the Community milestone Aug 23, 2018
@RyanCavanaugh
Copy link
Member

This would be pretty sweet. Accepting PRs on the TSJS lib generator repo for something that does this.

@jwbay
Copy link
Contributor

jwbay commented Dec 2, 2018

I opened a PR for this: microsoft/TypeScript-DOM-lib-generator#625

@sandersn
Copy link
Member

This is done now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants