This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 468188 - [tern] Provide a JSDoc content assist plugin
Summary: [tern] Provide a JSDoc content assist plugin
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: JS Tools (show other bugs)
Version: 6.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 11.0   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 439629 465029
  Show dependency tree
 
Reported: 2015-05-25 11:29 EDT by Michael Rennie CLA
Modified: 2015-11-19 17:48 EST (History)
1 user (show)

See Also:


Attachments
POC patch (43.78 KB, patch)
2015-11-16 10:47 EST, Michael Rennie CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Rennie CLA 2015-05-25 11:29:45 EDT
Currently we provide content assist and templates for JSDoc tags in the client-side of the JS bundle. It would be much nicer if we could move all the work into a Tern plug-in. 

Once in a plugin, we could also investigate pushing it back to Tern (since Tern already ships with a JSDoc-reading plugin)
Comment 1 Michael Rennie CLA 2015-05-25 11:55:48 EDT
We should use the tag list and conventions from: http://usejsdoc.org/ to include JSDoc 3 tags
Comment 2 Michael Rennie CLA 2015-06-02 15:31:57 EDT
This one should be pretty easy to do, we do not need to actually hook into any phases or provide our own request, we can simply add ourselves as a listener in the 'completion' event like:

tern.registerPlugin("jsdoc_assist", function(server, options) {

  function docCompletions(file, query) {
    //TODO copy code out of ternAssist.js into here for doc completions
    //also update the args of the stock query to include the context
  }

  return {
    completion: docCompletions
  };

}
Comment 3 Michael Rennie CLA 2015-11-13 13:39:00 EST
Provided the plugin skeleton and tag map:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=2592d9fe4bad060a698e18ad79660af4590a4147

Will have to modify Tern a bit to make this activate as expected since Tern does not callback for the 'completion' hook, if it cannot find an expression (which is always the case for doc)
Comment 4 Michael Rennie CLA 2015-11-16 10:47:30 EST
Created attachment 257978 [details]
POC patch

This patch moves all of our doc assist into the new plugin as a POC.

There is a lot of work to do to make it all work perfectly again, and there are many failing tests.

Remaining work to make it awesome:

1. hook up the eslint rule completion code again
2. hook up type completions in @link, {} cases
3. hook up type member completions
Comment 5 Michael Rennie CLA 2015-11-19 13:57:38 EST
Pushed updated logic (moved code from client to plugin) + hooks in the new plugin for type and type member completions:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=0400c67a3ad0aecdfd4ce36a1c713470ffff5129
Comment 6 Michael Rennie CLA 2015-11-19 17:48:34 EST
Pushed the remainder of the changes in:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=aa3e0486d270cdec24c7e173088a519be306ff24

All unit tests and smoke tests pass.

If we find any weirdness we can fix that in their own bugs.