tern icon indicating copy to clipboard operation
tern copied to clipboard

.tern-config file examples?

Open olalonde opened this issue 9 years ago • 11 comments
trafficstars

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.

olalonde avatar Apr 30 '16 23:04 olalonde

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.

ChartrandEtienne avatar May 17 '16 17:05 ChartrandEtienne

A .tern-project file like:

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

should get you up and running.

mrennie avatar May 19 '16 15:05 mrennie

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

olalonde avatar May 20 '16 02:05 olalonde

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.

marijnh avatar Jun 07 '16 11:06 marijnh

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.

silesky avatar Jul 29 '16 18:07 silesky

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.

chancez avatar Oct 07 '16 22:10 chancez

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

olalonde avatar Oct 07 '16 22:10 olalonde

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

rafaelrinaldi avatar Oct 12 '16 18:10 rafaelrinaldi

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

adeluccar avatar Jun 30 '17 14:06 adeluccar

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.

PezCoder avatar Jul 16 '17 12:07 PezCoder

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

aemonge avatar Jan 30 '19 14:01 aemonge