tern_for_vim icon indicating copy to clipboard operation
tern_for_vim copied to clipboard

Autocomplete for external libs doesn't work

Open mikeys opened this issue 9 years ago • 9 comments

Using Vim with YCM installed:

  • Create a new directory: mkdir cheerio & cd cheerio
  • Install the cheerio package: npm install cheerio (this creates a node_modules directory)
  • Create a .tern-project file and add the node plugin inside:
{
  "plugins": {
    "node": { }
  }
}
  • Edit a new file in vim (index.js for example) and start typing: vim tern_for_vim

Only the basic Object functions appear in the autocomplete menu.

  • Node modules seem to work just fine:

vim tern_for_vim http

Am I missing something? Is there anything else that I should do in order for enabling external libraries autocomplete ?

mikeys avatar Feb 10 '16 10:02 mikeys

I am seeing this too. With cheerio. But other modules seem fine. I guess this may have something to do with how cheerio defines methods or something.

artemave avatar Feb 10 '16 13:02 artemave

@artemave Well, I've tried express and koa packages as well:

express = require('express');
app = express();

app.

The above only shows my request and response objects...

mikeys avatar Feb 10 '16 13:02 mikeys

just checked with lodash package, seems to work fine...

I guess you're right, probably the way the module defines methods.

@marijnh any chance you can confirm this?

mikeys avatar Feb 10 '16 13:02 mikeys

Tern's type inference isn't infallible, it will fail to infer some types, especially when they are created with strange patterns.

marijnh avatar Feb 18 '16 10:02 marijnh

same issue with me

ehzawad avatar Jun 09 '17 08:06 ehzawad

Am also facing the same issue with "cheerio" package.

nagakiran avatar Aug 22 '17 03:08 nagakiran

I landed here due to the exact same scenario as @mikeys with express and app.

christopherball avatar Sep 17 '17 18:09 christopherball

Same, is it fixable somehow ? The issue has been opened for two years I'm curious is there is a workaround.

omartin avatar Nov 22 '18 12:11 omartin

I think this issue should belong to tern itself. https://github.com/ternjs/tern/ And for now, I don't plan to do large change to deal with strange patterns. So the best way is to write a plugin for the library you use.

othree avatar Nov 26 '18 09:11 othree