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

Inconsistent info in tooltips #126

Open
zaynv opened this issue Jul 2, 2016 · 4 comments
Open

Inconsistent info in tooltips #126

zaynv opened this issue Jul 2, 2016 · 4 comments

Comments

@zaynv
Copy link

zaynv commented Jul 2, 2016

For the same code, I keep getting different stuff in my tooltip hints:

1.

screen shot 2016-07-02 at 9 45 17 am

2.

screen shot 2016-07-02 at 9 12 16 am

3.

screen shot 2016-07-02 at 9 15 41 am

I would prefer for it to always be 3, but most of the time I get the result from image 2. Is there anything I can do to make it so that it is always like image 3?

Here are my Tern user settings:

{
  "tern_argument_hints": true,
  "tern_output_style": "tooltip",
  "tern_argument_completion": true
}

Thanks in advance!

@zaynv
Copy link
Author

zaynv commented Jul 2, 2016

This seems to actually happen if you close the editor. If you create the sum function during the current session and write the comments like so:

sum.js

/**
 * Returns the sum of two numbers
 * @param  {Number} a The first operand
 * @param  {Number} b The second operand
 * @return {Number}   The sum of both operands
 */
function sum (a, b) {
  return a + b
}

module.exports = sum

and then i go into app.js and do the following:

const sum = require('./sum')

sum(

I get the correct tooltip:

screen shot 2016-07-02 at 2 54 32 pm

However, if I restart the editor and try to type sum( again, I get a different output:

screen shot 2016-07-02 at 9 37 56 am

Is there any way around this?

@marijnh
Copy link
Member

marijnh commented Jul 4, 2016

Could you provide me with the relevant part of your math.js file, so that I can see if I can reproduce this?

@zaynv
Copy link
Author

zaynv commented Jul 4, 2016

Ah sorry, it was actually the same thing as sum.js I just named it differently that time.

Steps to reproduce:

1. Create an app.js and sum.js and open them in Sublime
2. Add the following to sum.js:

/**
 * Returns the sum of two operands
 * @param  {Number} a The first operand
 * @param  {Number} b The second operand
 * @return {Number}   The sum of both operands
 */
function sum (a, b) {
  return a + b
}

3. Add the following to app.js:

const sum = require('./sum')

sum(

At this point, everything works fine:

screen shot 2016-07-04 at 2 44 04 pm

Now, if you exit out of Sublime and reopen it, and then try doing sum( again, you will get this output instead:

screen shot 2016-07-04 at 2 46 27 pm

@marijnh
Copy link
Member

marijnh commented Aug 16, 2016

I didn't manage to reproduce this. If I add the module.exports = sum line to the content you describe, I get working argument hints.

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

2 participants