angelozerr / tern-node-express

A Tern plugin adding support for express web application framework for node.
http://expressjs.com/
MIT License
56 stars 4 forks source link

Generate node-express from JS sources with dox #8

Open angelozerr opened 9 years ago

angelozerr commented 9 years ago

Today the JSON Type Definition of node-express is written at hand.

It should be cool if we can generat eit from JS express sources.

To do that we could use dox generates a JSON representation of the JS code.

node-mongodb-native use dox to generate their doc. See exports.extractLibraryMetaData : https://github.com/mongodb/node-mongodb-native/blob/master/dev/tools/docs.js#L81

Here my idea to generate JSON Type Definition of node-express :

Note that dox JSON representation information is not enough, because it doesn't provide the structure for callback function. We should inject those information while transformation.

ghost commented 9 years ago

Tern-node-express is almost done by now. What I do not like with the handwriting is the time it takes and errors that inevitably arise. But would automation do much better? It also takes time to read it back comparing with the original documentation as errors inevitably arise too: I'll probably hate it even more...

angelozerr commented 9 years ago

What I do not like with the handwriting is the time it takes and errors that inevitably arise

Are you disapointed with tern?

I'll probably hate it even more...

It seems you don't like this idea -(

My idea is to generate the same thing that we have written at hand. So once generator will be done, we could generate tern express for any version. This generator will able to generate other fwk like https://github.com/angelozerr/tern-node-mongodb

But let's me shows you my idea. I have started (not commited) something to generate https://github.com/angelozerr/tern-node-mongodb

ghost commented 9 years ago

Are you disapointed with tern?

But why? The plugin is working fine in Eclipse. The json typing is quite a boring task indeed but it's not the end of it.

It seems you don't like this idea -(

But I am open to test it for real: you generate the json data then I'll review it and we'll see how many corrections it takes.

angelozerr commented 9 years ago

But why? The plugin is working fine in Eclipse. The json typing is quite a boring task indeed but it's not the end of it.

You have tested it with Eclipse? If it's that, it's cool! I was a little afraid that you were disapointed with tern.

But I am open to test it for real: you generate the json data then I'll review it and we'll see how many corrections it takes.

Ok I contact you as soon as I will finish it.

ghost commented 9 years ago

I am in the process of testing tern-node-express in a nodeclipse project finding too many auto-completion mistakes: how do you want to address these issues? One by one manually or by building a new json data handler from dox parsing?

angelozerr commented 9 years ago

One by one manually or by building a new json data handler from dox parsing?

node-express is not generated (it is written at hand).

I think you should create an issue per problem and fix it at hand. After if you think it's better to generate node-express from JS sources, tell me and I will do it.

ghost commented 9 years ago

On a matter of principle I wonder what will happen with doxified json when express documentation will be updated. When it was done from keyboard strokes we'll have to patch it manually indeed. But when it was done with dox then patched manually for mistakes or unresolved cases then will we have to fully repatch it manually for every next dox output?

Pratically – it would be interesting to compare what we did manually with what dox is actually generating: in many case dox could have it right (or better) but the contrary is also possible.

In other words I don't know what's the best practice here but eager to find out.

In conclusion: if you could generate the json with dox to send it to me then I would compare both to address issues manually - is this making sense?

angelozerr commented 9 years ago

Ok, so I think we should generate node-express (like we have doen with node-mongoose an dnode-mongodb-native). As I explained you, the generation is done but you can override !type as you wish, so we could have the same tern plugin with or without generation for node-express.

Is there a lot of problems with node-express? I think it should be very good if you create an issue per problem to trace it (and perhaps create some test about that).