Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

add package.json #1

Closed
wants to merge 2 commits into from

2 participants

@ramitos

the acorn dependency is from github and not from npm because the npm version is not the latest and doesn't have stuff like walk.findNodeBefore

@marijnh
Owner

Thanks. I've merged in the package.json patch. I left out the example patch since the interface is completely in flux for the moment, and I don't want to have to update any more code than necessary when I change something.

@marijnh marijnh closed this
@ramitos

Sorry, I was playing with tern and pushed the changes to my master after the PR. Github also included the commit and I wasn't aware of that :/

@marijnh
Owner

Yeah, pull requests are 'live' in that they follow changes to the branch they refer to. No problem though, it was easy to pick out the relevant commit.

@ramitos

Yeah, I didn't know about the 'live' updates.

You should publish tern in the npm registry ;)

Amazing work, btw

@marijnh
Owner

You should publish tern in the npm registry

I will, once it's halfway stable.

@ramitos ramitos referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 8, 2013
  1. @ramitos

    add package.json

    ramitos authored
Commits on Mar 9, 2013
  1. @ramitos

    add example

    ramitos authored
This page is out of date. Refresh to see the latest.
View
56 example/main.js
@@ -0,0 +1,56 @@
+var fs = require('fs')
+var tern = require('../')
+var acorn = require('acorn')
+var path = require('path')
+
+var environment = [
+ JSON.parse(fs.readFileSync('ecma5.json')),
+ JSON.parse(fs.readFileSync('browser.json'))
+]
+
+var files = {
+ 'name_of_the_file.js': fs.readFileSync(path.join(__dirname, 'name_of_the_file.js'), 'utf8'),
+ 'name_of_other_file.js': fs.readFileSync(path.join(__dirname, 'name_of_other_file.js'), 'utf8')
+}
+
+var getFile = function (name, callback) {
+ callback(null, files[name])
+}
+
+var server = new tern.Server({getFile: getFile}, environment)
+
+server.addFile('name_of_the_file.js')
+server.addFile('name_of_other_file.js')
+
+
+
+server.request({
+ query: {
+ type: 'completions',
+ end: 8,
+ file: 'name_of_the_file.js'
+ },
+ files: [
+ {
+ type: 'full',
+ name: 'name_of_the_file.js',
+ text: files['name_of_the_file.js']
+ }
+ ]
+}, function (e, data) {
+ if(e) throw e
+ console.log(require('util').inspect(data.completions));
+})
+
+
+server.request({
+ query: {
+ type: 'type',
+ end: 39,
+ file: 'name_of_other_file.js'
+ },
+ files: []
+}, function (e, data) {
+ if(e) throw e
+ console.log(require('util').inspect(data));
+})
View
5 example/name_of_other_file.js
@@ -0,0 +1,5 @@
+var fn = function (a) {return a+10};
+
+fn
+
+var b = ""
View
3  example/name_of_the_file.js
@@ -0,0 +1,3 @@
+console.
+
+var a = []
View
18 package.json
@@ -0,0 +1,18 @@
+{
+ "name": "tern",
+ "license": "MIT",
+ "version": "0.0.1",
+ "author": "Marijn Haverbeke <marijnh@gmail.com>",
+ "description": "A JavaScript code analyzer for deep, cross-editor language support",
+ "main": "tern.js",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/marijnh/tern.git"
+ },
+ "scripts": {
+ "test": "node test.js"
+ },
+ "dependencies": {
+ "acorn": "git://github.com/marijnh/acorn.git"
+ }
+}
Something went wrong with that request. Please try again.