nb-nodejs icon indicating copy to clipboard operation
nb-nodejs copied to clipboard

Module exports are not shown in code completion

Open gyszalai opened this issue 11 years ago • 4 comments

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 avatar Mar 01 '13 11:03 gyszalai

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

gyszalai avatar Mar 01 '13 11:03 gyszalai

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.

timboudreau avatar Mar 01 '13 19:03 timboudreau

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.

gyszalai avatar Mar 01 '13 20:03 gyszalai

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...

timboudreau avatar Jun 17 '13 00:06 timboudreau