Feature request: generate type definitions for Web APIs from Web IDL files

15 views
Skip to first unread message

Alain Kalker

unread,
Nov 3, 2014, 4:32:38 PM11/3/14
to tern...@googlegroups.com
I know that Tern ships with a type definition file "browser.json", which mostly covers the DOM, it would be nice to have definitions for other major APIs like Web Animations, Web Audio, HTML5 Canvas, etc, for auto completion and type information.

I think it should not be too difficult to generate type definition files directly from Web IDL[1] as used in the API standard documents by major browsers[2][3]. The Mozilla project collects them all in a convenient place[4].

There are many Web IDL parsers out there, some of them written in JavaScript, such as this one[5]. I think it should not be too hard to transform the generated AST to Tern's type definition format.

Any ideas, suggestions?

--Alain

[1]: Web IDL - Wikipedia, the free encyclopedia : http://en.wikipedia.org/wiki/Web_IDL
[2]: Web IDL in Blink - The Chromium Projects : http://www.chromium.org/blink/webidl
[4]: mozilla-central mozilla/dom/webidl/ : http://mxr.mozilla.org/mozilla-central/source/dom/webidl/
[5]: darobin/webidl2.js : https://github.com/darobin/webidl2.js

othree

unread,
May 23, 2015, 4:08:43 AM5/23/15
to tern...@googlegroups.com
I am doing this right now[1].
But in a very beginning stage.

I have another project is use webidl to generate vim syntax[2] is almost complete.
So I think its possible to do this.

But the result will not have doc and url property.
Firefox nightly now have mdn doc in developer tool.
But I can't find where the data stored.

Also another issue is the result size will very large than current one.
Not sure will it impact performance.

[1]:https://github.com/othree/webidl-to-tern-def
[2]:https://github.com/othree/webidl-to-vim-syntax

Alain Kalker於 2014年11月4日星期二 UTC+8上午5時32分38秒寫道:
Reply all
Reply to author
Forward
0 new messages