You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
JS code hints aren't picking up new items added to exportsΒ #4991
Some notes about this: I cannot reproduce this in the Tern demo, so it would seem that this is related to how we're using Tern.
Watching the behavior of ScopeManager, I can confirm that we're sending Tern an "update file" message for MyModule.js with the correct, updated text. To fix this bug, it looks like I'm going to have to dig a deeper into what's happening inside of Tern.
Finally getting back to this one to take a closer look. I think I understand the problem and why it works in the Tern demo but not in Brackets. In Brackets, when we update a file, we send the new text to Tern identifying the file by its full path. When Tern sees require("MyModule"), it asks us for "MyModule.js" and we happily send the file's contents over to Tern. When Tern then does hinting for MyModule, it's using the contents of MyModule.js that we provided when Tern asked for them. It doesn't update the hints when we send along updates for /full/path/to/MyModule.js. (To make things more confusing, we reset the Tern worker periodically... when that happens, the hints will update, so it will appear that the hints update randomly!)
The fix for this would seem to be either:
we stop sending full paths to Tern
a change to the require plugin to ask for the path differently
a change to Tern itself to adjust paths
I don't think the first choice will work because of projects like Brackets itself. The files are all under src/, so we'd still run into the problem where we send Tern a file like src/strings.js and Tern asks for strings.js.
I can't find it now, but I know we ultimately would like to parse require configurations. I don't think we'd have to go that far to fix this, though.
provide a way to configure Tern's require JS (short of actually stumbling across the script with the require configuration and parsing that)
Strictly speaking, the first one will fix this bug as described. However, for projects like Brackets where the modules are in some directory other than the root, you'd still need the second step to do this right. Since JS Code Hints already has its own preferences code, we don't need to wait on the prefs system to implement that second step.
Activity
njx commentedon Aug 29, 2013
It seems like something's broken about how we update hints from other files.
njx commentedon Aug 29, 2013
To @dangoor, nominating for sprint 31.
njx commentedon Sep 16, 2013
Reassigning for me to look at for now.
dangoor commentedon Sep 18, 2013
I'm going to reclaim this and move it to sprint 32 since we're pencils down on sprint 31.
dangoor commentedon Oct 25, 2013
Some notes about this: I cannot reproduce this in the Tern demo, so it would seem that this is related to how we're using Tern.
Watching the behavior of ScopeManager, I can confirm that we're sending Tern an "update file" message for MyModule.js with the correct, updated text. To fix this bug, it looks like I'm going to have to dig a deeper into what's happening inside of Tern.
dangoor commentedon Nov 12, 2013
Finally getting back to this one to take a closer look. I think I understand the problem and why it works in the Tern demo but not in Brackets. In Brackets, when we update a file, we send the new text to Tern identifying the file by its full path. When Tern sees
require("MyModule"), it asks us for "MyModule.js" and we happily send the file's contents over to Tern. When Tern then does hinting for MyModule, it's using the contents of MyModule.js that we provided when Tern asked for them. It doesn't update the hints when we send along updates for/full/path/to/MyModule.js. (To make things more confusing, we reset the Tern worker periodically... when that happens, the hints will update, so it will appear that the hints update randomly!)The fix for this would seem to be either:
I don't think the first choice will work because of projects like Brackets itself. The files are all under
src/, so we'd still run into the problem where we send Tern a file likesrc/strings.jsand Tern asks forstrings.js.I can't find it now, but I know we ultimately would like to parse require configurations. I don't think we'd have to go that far to fix this, though.
dangoor commentedon Nov 12, 2013
Ahh, here's the card for require configuration.
dangoor commentedon Nov 12, 2013
I think the right solution here is probably to:
Strictly speaking, the first one will fix this bug as described. However, for projects like Brackets where the modules are in some directory other than the root, you'd still need the second step to do this right. Since JS Code Hints already has its own preferences code, we don't need to wait on the prefs system to implement that second step.
dangoor commentedon Nov 13, 2013
Moving to sprint 35.
dangoor commentedon Dec 5, 2013
Doesn't look like I'll get this wrapped up in 35. Moving to 36.
peterflynn commentedon Apr 11, 2014
Marking needs review to consider 1.0 in/out question after JS code hints architecture research
peterflynn commentedon Aug 15, 2014
Reviewed -- doesn't seem necessary for 1.0 (CC @dangoor in case you have concerns with removing the milestone)
dangoor commentedon Aug 21, 2014
Yeah, I think we can remove this from 1.0. I think we should fix this when we fix code hints preferences