ternjs / tern

A JavaScript code analyzer for deep, cross-editor language support
https://ternjs.net/
MIT License
4.25k stars 378 forks source link

.tern-config file examples? #759

Open olalonde opened 8 years ago

olalonde commented 8 years ago

It would be nice to have a list of sample .tern-config files for different setups. I've been reading the docs for a while and still can't figure out how to get autocompletion to work on imported modules.

ChartrandEtienne commented 8 years ago

Intriguing, what's your environment?

I have a node project, and this


// .tern-project.js
{
    "plugins": {
        "node": {}
    }
}

was sufficient to get autocomplete and type hints in the Vim plugin.

mrennie commented 8 years ago

A .tern-project file like:

{
    "plugins": {
        "es_modules": {}
    },
    "libs": [
        "ecma5",
        "ecma6"
    ],
    "ecmaVersion": 6
}

should get you up and running.

olalonde commented 8 years ago

Weird, that works when I put .tern-project in my project root but it doesn't work it in ~/.tern-config

marijnh commented 8 years ago

Can you provide the content of your .tern-project and .tern-config in both working an non-working state, and describe what exactly doesn't work? The two files should be interpreted in pretty much the same way.

silesky commented 8 years ago

my (global) ~/.tern-config looks like this:

{
    "plugins": {
        "node": {}
    }
}

I did it to squash the error messages in vim for the stray javascript file where a .tern-project is not defined. It seems to work.

I, too, would like to see some examples.

chancez commented 8 years ago

I cannot believe there are no examples for the global tern-config. I cannot get youcompleteme working without a default config. I write very little JS, and only need basic completion of ES5 and if I need something more specific I can begin to explore project specific files, but it would be ideal if tern shipped a good example ~/.tern-config so I can know where to even begin.

olalonde commented 8 years ago

My current ~/.tern-config is:

{
  "plugins": {
    "node": {},
    "es_modules": {}
  },
  "libs": [
    "ecma5",
    "ecma6"
  ],
  "ecmaVersion": 6
}

Not sure exactly what it does but once in a while I get smart auto completion in Vim :D

rafaelrinaldi commented 8 years ago

@olalonde FTR the best example I have found so far is from a TernJS plugin for Atom: https://atom.io/packages/atom-ternjs

adeluccar commented 7 years ago

This SO answer also helped me understand this file a little more. https://stackoverflow.com/a/41377689/1253966

PezCoder commented 7 years ago

This is the base ~/.tern-config I'm using for my VIM.

{
  "libs": [
    "browser",
    "jquery",
    "react"
  ],
  "plugins": {
      "angular": {},
      "doc_comment": null,
      "es_modules": {},
      "node": {}
  },
  "dontLoad": [
      "node_modules/**"
  ]
}

I work in react, angular mainly so the above works well for me.

aemonge commented 5 years ago

How would the config be if you want to import the RxJs library ?