Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete for external libs doesn't work #126

Open
mikeys opened this issue Feb 10, 2016 · 9 comments
Open

Autocomplete for external libs doesn't work #126

mikeys opened this issue Feb 10, 2016 · 9 comments

Comments

@mikeys
Copy link

mikeys commented Feb 10, 2016

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 ?

@artemave
Copy link

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.

@mikeys
Copy link
Author

mikeys commented Feb 10, 2016

@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
Copy link
Author

mikeys commented Feb 10, 2016

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?

@marijnh
Copy link
Member

marijnh commented Feb 18, 2016

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

@ehzawad
Copy link

ehzawad commented Jun 9, 2017

same issue with me

@nagakiran
Copy link

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

@christopherball
Copy link

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

@omartin
Copy link

omartin commented Nov 22, 2018

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

@othree
Copy link
Collaborator

othree commented Nov 26, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants