timboudreau / nb-nodejs

NodeJS support for NetBeans, originally hosted on netbeans.org
MIT License
91 stars 12 forks source link

Module exports are not shown in code completion #2

Open gyszalai opened 11 years ago

gyszalai commented 11 years ago

It may be the NB JavaScript editor's fault, but Node module exports are not shown in code completion. E.g. if you require the http module, the createServer exported function is not shown if I press CTRL-SPACE.

gyszalai commented 11 years ago

Forgot to mention it's NetBeans 7.3 final and Ubuntu 12.10.

timboudreau commented 11 years ago

It is, but there may some things we can do about it from the Node module. The Javascript editor support in NetBeans was rewritten from scratch for 7.3 - and it does do better with commonjs stuff. Code completion has improved, but isn't perfect (and, given the nature of Javascript, probably never will be). I am in touch with my former colleagues who rewrote the JS editor in NetBeans, so I hope to find out more.

The old JS editor support let you supply a ClassPath object (inherited from the Java editor API) to point to library sources. Probably this needs some revisiting in the new editor, but there's certainly some way of doing it.

gyszalai commented 11 years ago

Thanks! I hope it'll improve in the upcoming NetBeans versions. I think NetBeans with your plugin is far better for Node.js development than any other tool we tried so far. Though we are very new to Node.js.

timboudreau commented 11 years ago

FWIW, version 2.10 and up have an API for resolving require() references by name, and a set of stub js files with the signatures of Node's built-in modules exports. Writing something that will actually use it is a longer project - NetBeans' API for javascript code completion is not for the faint of heart - I've been looking at the implementation of JQuery completion...