2

I am using the ternjs for vim plugin (based on tern js project) and standard vim omni-completion.
I am unable to get basic eager loading working with tern or I am misunderstanding how the loadEagerly option is supposed to work.
Here is my setup of files:

% tree -a 
.
├── index.html
├── index.js
├── lib.js
├── Session.vim
└── .tern-project

file: index.html

<html>
<head>
    <title>test tern</title>

</head>
<body>
    <p>Hello world</p>
    <script src="lib.js"></script>
    <script src="index.js"></script>
</body>
</html>

file: lib.js

var namespace = {
    fruits : ['apple', 'bannana', 'orange'],
        text : "A tremor in the Force. The last time I felt it was in the presence of my old master."
};

function go(compare_me) {
    return compare_me === "reference";
}

file: .tern-project

{
    "libs": [
        "ecma5",
        "browser"
    ],
    "loadEagerly": ["*.js"],
    "plugins": {
        "node": {}
    }
}

tern itself is working, e.g. if I am in lib.js and type:
gCtrl-xCtrl-o
go (fn) appears in autocompletion dropdown list and a function signature appears in the preview window:

fn(compare_me: ?) -> bool 

Now when I open index.js I am expecting "loadEagerly" to cause variables and functions from lib.js to appear in completion.
But its not - autocompletion is unresponsive, why?

3
  • 1
    Have you tried to use ternjs directly? Then you could understand if the problem is with ternjs or the Vim plugin. You could also you try the issue tracker?
    – mMontu
    Mar 24, 2016 at 10:52
  • @mMontu I didn't know it was possible to use ternjs directly but good idea, I will take a look. From what I have read in the issue threads loadEagerly works - and people have since moved on to discussions like *how do I get **/* patterns to work with loadEagerly or sometimes pattern A works but sometimes I need pattern B etc... But noone has seemed to raise the issue that loadEagerly is totally broken. But maybe for vim it is...? Mar 24, 2016 at 11:03
  • Probably this Vim plugin just provide an easier interface for the ternjs, so the loadEagerly is probably just transferred by the plugin. There are more issues on ternjs about the loadEagerly than in the plugin.
    – mMontu
    Mar 24, 2016 at 11:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.