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

How to manage parameter function which can have several types? #2

Closed angelozerr closed 9 years ago

angelozerr commented 9 years ago

What would be the tern syntax for this case below? Where the [value] parameter is optionnal, knowing its a key:value pair when it's used but a JSON object when unused:

res.set(field, [value])
//Set header field to value, or pass an object to set multiple fields at once.
res.set('Content-Type', 'text/plain');
res.set({
 'Content-Type': 'text/plain',
 'Content-Length': '123',
 'ETag': '12345'
})
angelozerr commented 9 years ago

In short answer, tern is not able to support several types for a parameter. So you must choose the function which is the most used. I think I will manage :

res.set({
 'Content-Type': 'text/plain',
 'Content-Length': '123',
 'ETag': '12345'
})
angelozerr commented 9 years ago

Ok see my commit https://github.com/angelozerr/tern-express/commit/878b9b39ffe044ce57078db127fa952345d44902 to know how to manage app.get with function Request/Response

ternexpressresponsewithcodemirror

ghost commented 9 years ago

CodeMirror doesn't work for me in express.html demo:

detailed error: ReferenceError: CodeMirror is not defined error source line: CodeMirror.commands.autocomplete = function(cm) { rse4594...3128efs (line 86, col 6)

screen shot 2014-10-01 at 10 28 24

It does not show from this screen capture but the cursor was actually set after the period on third statement: no code completion - etc.

Last but not least the URL link in this page is raising a 404 error:

angelozerr commented 9 years ago

In your screenshot you have not the well CSS and well JS.

If you get the tern-express project on your computer and you open express.html, it should work? Have you check that you have this hierarchy https://github.com/angelozerr/tern-express/tree/master/demos on your computer?

ghost commented 9 years ago

The project I have was git clone this morning from github repository

ghost commented 9 years ago

screen shot 2014-10-01 at 13 17 14

ghost commented 9 years ago

OK - this was a problem with eclipse internal browser actually: when opened with "web editor" from eclipse, express.html is not opened from its real location but from eclipse's workspace and this doesn't work. When I drop express.html file directly into Firefox window then it works fine.

ghost commented 9 years ago

The link to https://github.com/angelozerr/tern.express is still not working in both cases: error 404 page not found

angelozerr commented 9 years ago

I close this issue since now it support callback function array.