Closed ghost closed 9 years ago
$ cat .project <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>Local_boilerplate</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>tern.eclipse.ide.core.ternBuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>tern.eclipse.ide.core.ternnature</nature> </natures> </projectDescription>
Have you checked node-express in the Modules page : in other words in your .tern-project you should have node + node-express in the plugins section.
I don't have any .tern-project at project root. It's not a tern project but an express-mongoose project created manually from IDE (new folder then new files then Configure > Convert to Tern)
Without .tern-project tern.js cannot work. It contaisn list of JSON Type Definition and plugins that it must load.
I don't have any .tern-project at project root
If you have done " Configure > Convert to Tern", you have it but I suppose you don't see in the project explorer (like .project or .classpath). Use Navigation explorer or your system folder to see it.
If you don't have it, I don't understand, retrywith a new project.
I suggest you that you read https://github.com/angelozerr/tern.java/wiki/Tern-&-Node-Express-support to see how to activate tern node express
Configure > Convert to Tern didn't create a .tern-project but added tern nature and buid command to existing .project file as shown above: I think this is a flaw as a .tern-project file was expected.
I understand it's possible to do it otherwise but as long as you can select Configure > Convert to Tern then it should provide.
To reproduce the issue, create a directory from a terminal then promote it to project from IDE remote systems panel. At this stage you'll get an "empty" .project file.
Now convert the project to Tern: it inserts new value in existing .project file when it should create a new .tern-project file: this is the issue I am reporting.
It's normal, you should check node-express in the Modules preferences page, after that .tern-project will be created. But I think I will change this behaviour for 0.7.0 (see https://github.com/angelozerr/angularjs-eclipse/issues/108)
I think I must develop https://github.com/angelozerr/tern.java/issues/68 to avoid having an issue like you have created here.
I don't have a tern module page in preferences:
As I said you, please read https://github.com/angelozerr/tern.java/wiki/Tern-&-Node-Express-support you will see that it's project properties (and not global preferences).
Project properties: that makes sense - see below. I should be ready for mongodb/mongoose by now...
But no - still not working:
$ cat .tern-project {"ide":{"scriptPaths":[]},"libs":["ecma5"],"plugins":{"node":{},"node-express":{},"node-mongodb-native":{},"node-mongoose":{}}}iMac27:boilerplate
No auto-completion on tern-node-mongoose but this is probably same issue:
Am I correct assuming the red spot errors above are raised by tern ecma5 module?
I don't understand, it should work?
When you have problem with tern like your problem, you can activate tern console https://github.com/angelozerr/tern.java/wiki/images/EclipseIDE_TernConsoleProperty.png
After that you will see how to node is started and JSON request/response.
Am I correct assuming the red spot errors above are raised by tern ecma5 module?
No, those error comes from JSDT. If you wish to have tern errors, please read https://github.com/angelozerr/tern.java/wiki/Tern-&-Validation
I don't understand, it should work?
Well - that's what testings are about...
I don't get any trace in tern console.
After I typed res.
I've got JSDT syntax error showing up instead of tern auto-completion.
Please send me your project. Thank's
Project sent
I don't have jshint plugin installed — do we have any dependency broken here? See below:
I don't have jshint plugin installed — do we have any dependency broken here? See below:
it's an other issue than tern.java
Your project works for me. Tern console doesn't work?
Have you tried just to create a new project and add browser module and try document completion, etc ? is it working?
Try just to select node-express + node + ecma5 (not mongoose + mongodb)
Nodejs Commnand: "/opt/local/bin/node" "/Applications/eclipse/plugins/tern.core_0.7.0.201410140810/node_modules/tern/bin/tern" --no-port-file Project dir: /Users/pperroud/Projects/boilerplate
Server started at 51333 in 124ms Tern request#: {"files":[{"name":"app03.js","text":"/*\n * New node file\n /\n\nvar mongoose = require('mongoose');\nvar express = require('express');\n\nmongoose.connect('mongodb://localhost',function(err) {\n\tif(err) throw err;\n\tconsole.log('connected to mongodb...');\n\t\n\tvar app = express();\n\t\n\tapp.get('/', function(req,res) {\n\t\tres.status(200).send('Hello World!');\n\t});\n\t\n\tapp.listen(3000, function() {\n\t\tconsole.log('Listening on localhost:3000');\n\t});\n});\n","type":"full"}]}
{}
Tern request#type: {"query":{"type":"type","file":"app03.js","end":151,"docs":true,"urls":true,"types":true}} Tern response#type with 1256ms:
Tern request#: {"files":[{"name":"app03.js","text":"/*\n * New node file\n /\n\nvar mongoose = require('mongoose');\nvar express = require('express');\n\nmongoose.connect('mongodb://localhost',function(err) {\n\tif(err) throw err;\n\tconsole.log('connected to mongodb...');\n\t\n\tvar app = express();\n\t\n\tapp.get('/', function(req,res) {\n\t\tres.status(200).send('Hello World!');\n\t});\n\t\n\tapp.listen(3000, function() {\n\t\tconsole.log('Listening on localhost:3000');\n\t});\n});\n","type":"full"}]}
Tern request#type: {"query":{"type":"type","file":"app03.js","end":114,"docs":true,"urls":true,"types":true}} Tern response#type with 11ms:
{}
Is tern responding with empty json?
When I insert res.
within app.get() scope I am getting JSDT error but nothing in Tern terminal – like it was catched by JSDT before it could reach tern...
Nodejs Commnand: "/opt/local/bin/node" "/Applications/eclipse/plugins/tern.core_0.7.0.201410140810/node_modules/tern/bin/tern" --no-port-file Project dir: /Users/pperroud/Projects/boilerplate .tern-project: {"ide":{},"libs":["browser","ecma5"],"plugins":{"node":{},"node-express":{}}} Tern request#:
{"files":[{"name":"app03.js","text":"/*\n * New node file\n /\n\nvar mongoose = require('mongoose');\nvar express = require('express');\n\nmongoose.connect('mongodb://localhost',function(err) {\n\tif(err) throw err;\n\tconsole.log('connected to mongodb...');\n\t\n\tvar app = express();\n\t\n\tapp.get('/', function(req,res) {\n\t\tres.status(200).send('Hello World!');\n\t\tres.\n\t});\n\t\n\tapp.listen(3000, function() {\n\t\tconsole.log('Listening on localhost:3000');\n\t});\n});\n","type":"full"}]}
{}
Tern request#type: {"query":{"type":"type","file":"app03.js","end":313,"docs":true,"urls":true,"types":true}}
{"type":"fn(req: request.Request, res: response.Response)","origin":"app03.js"}
HTML seem to be working:
@nodeleaf I'm a little lost.
HTML seem to be working
HTML completion is not the same thing than tern completion.
Is tern responding with empty json?
Yes, it returns every time a JSON response.
It seems that your tern console works, no? I though your tern console didn' t work?
Ok, takes teh following sample :
var mongoose = require('mongoose');
mongoose. // here Ctrl+Space should shows completion items
Is this case works? If it doesn' work, have you a JSON request.response for completion. You should have this trace:
Tern request#completions:
{"query":{"type":"completions","file":"app01.js","end":71,"types":true,"docs":true,"urls":true,"origins":true,"caseInsensitive":true,"lineCharPositions":true,"expandWordForward":false}}
Tern response#completions with 13ms:
{"start":{"line":5,"ch":9},"end":{"line":5,"ch":9},"isProperty":true,"completions":[{"name":"connect","type":"fn(uri: string, options?: Object, callback?: fn()) -> index.Mongoose","doc":"\n\nOpens the default mongoose connection.","origin":"node-mongoose"},{"name":"connection","type":"?","origin":"node-mongoose"},{"name":"createConnection","type":"fn(uri?: string, options?: Object) -> connection.Connection","doc":"\n\nCreates a Connection instance.","origin":"node-mongoose"},{"name":"disconnect","type":"fn(fn?: fn()) -> index.Mongoose","doc":"\n\nDisconnects all connections.","origin":"node-mongoose"},{"name":"get","type":"?","doc":"\n\nGets mongoose options","origin":"node-mongoose"},{"name":"model","type":"fn(name: string, schema?: schema.Schema, collection?: string, skipInit?: bool) -> fn(doc: Object)","doc":"\n\nDefines a model or retrieves it.","origin":"node-mongoose"},{"name":"modelNames","type":"fn() -> [?]","doc":"\n\nReturns an array of model names created on this instance of Mongoose.","origin":"node-mongoose"},{"name":"mongo","type":"?","doc":"\n\nThe <a href=\"https://github.com/mongodb/node-mongodb-native\">node-mongodb-native</a> driver Mongoose uses.","origin":"node-mongoose"},{"name":"mquery","type":"?","doc":"\n\nThe <a href=\"https://github.com/aheckmann/mquery\">mquery</a> query builder Mongoose uses.","origin":"node-mongoose"},{"name":"plugin","type":"fn(fn: fn(), opts?: Object) -> index.Mongoose","doc":"\n\nDeclares a global plugin executed on all Schemas.","origin":"node-mongoose"},{"name":"set","type":"fn(key: string, value: string)","doc":"\n\nSets mongoose options","origin":"node-mongoose"},{"name":"version","type":"?","doc":"\n\nThe Mongoose version","origin":"node-mongoose"},{"name":"Collection","type":"fn(db: Object, collectionName: string, pkFactory?: Object, options?: Object) -> Object","doc":"\n\nThe Mongoose Collection constructor","url":"http://mongodb.github.io/node-mongodb-native/api-generated/collection.html","origin":"node-mongoose"},{"name":"Connection","type":"fn(base: index.Mongoose)","doc":"\n\nThe Mongoose <a href=\"#connection_Connection\">Connection</a> constructor","origin":"node-mongoose"},{"name":"Document","type":"fn(obj: Object, fields?: Object, skipId?: bool)","doc":"\n\nThe Mongoose <a href=\"#document-js\">Document</a> constructor.","origin":"node-mongoose"},{"name":"Error","type":"?","doc":"\n\nThe <a href=\"#error_MongooseError\">MongooseError</a> constructor.","origin":"node-mongoose"},{"name":"Model","type":"fn(doc: Object)","doc":"\n\nThe Mongoose <a href=\"#model_Model\">Model</a> constructor.","origin":"node-mongoose"},{"name":"Mongoose","type":"fn()","doc":"\n\nThe Mongoose constructor","origin":"node-mongoose"},{"name":"Promise","type":"fn(fn: fn())","doc":"\n\nThe Mongoose <a href=\"#promise_Promise\">Promise</a> constructor.","origin":"node-mongoose"},{"name":"Query","type":"fn(options?: Object, model?: Object, conditions?: Object, collection?: Object)","doc":"\n\nThe Mongoose <a href=\"#query_Query\">Query</a> constructor.","origin":"node-mongoose"},{"name":"STATES","type":"?","doc":"\n\nExpose connection states for user-land","origin":"node-mongoose"},{"name":"Schema","type":"fn(definition: Object)","doc":"\n\nThe Mongoose <a href=\"#schema_Schema\">Schema</a> constructor","origin":"node-mongoose"},{"name":"SchemaType","type":"fn(path: string, options?: Object, instance?: string)","doc":"\n\nThe Mongoose <a href=\"#schematype_SchemaType\">SchemaType</a> constructor","origin":"node-mongoose"},{"name":"SchemaTypes","type":"?","doc":"\n\nThe various Mongoose SchemaTypes.","origin":"node-mongoose"},{"name":"Types","type":"?","doc":"\n\nThe various Mongoose Types.","origin":"node-mongoose"},{"name":"VirtualType","type":"fn()","doc":"\n\nThe Mongoose <a href=\"#virtualtype_VirtualType\">VirtualType</a> constructor","origin":"node-mongoose"}]}
For records, on MacOS X ctrl-space is used by spotlight by default: this could be turned off from system preferences:
I must be missing something important in the installation process as tern-node-express is not working for me as shown in snapshot below.