|
Re: JavaDoc parser [message #513133 is a reply to message #512994] |
Mon, 08 February 2010 21:18 |
|
On 2/8/2010 9:14 AM, Keya wrote:
> Hi,
>
> I want to obtain the JavaScript documentation associated with every
> element/node in the given JS File.
>
> I have tried ASTParser and couple of mode available with WebTools but
> apparently I get just a chink of JavaScipt in the whole JS file. There
> is no further information about it's mapping to the corresponding element.
>
> Please let me know if the feature is supported in WebTools and if so
> what is the correct way to obtain the required information.
Usually you would do this by calling on the
org.eclipse.wst.jsdt.ui.JSdocContentAccess class on a file in a
JavaScript project's Include Path. You can get a model for the entire
file using
org.eclipse.wst.jsdt.core.JavaScriptCore#createCompilationUn itFrom(IFile) and
then iterate through its children as you wish.
--
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
|
Re: JavaDoc parser [message #513394 is a reply to message #513203] |
Tue, 09 February 2010 19:16 |
|
On 2/9/2010 6:14 AM, Keya wrote:
> Hi Nitin,
>
> The parser you have mentioned is fine and works for the JS file sitting
> in a project.
> I have an additional requirement to parse a non-workspace file for the
> JavaDoc. These are basically the user libraries that I can attach with
> the JS Project. Can you please tell me what's the correct way of
> obtaining the 'org.eclipse.wst.jsdt.core.IJavaScriptUnit' instance from
> 'org.eclipse.wst.jsdt.internal.compiler.batch.CompilationUni t'?
The closest thing we have for that kind of task is
org.eclipse.wst.jsdt.internal.core.util.CodeSnippetParsingUt il#parseCompilationUnit(char[],
Map, boolean), which is very much internal. You can, however, then use
a org.eclipse.wst.jsdt.core.ast.ASTVisitor to walk the AST for comments.
It's not nearly as easy to use, but then arbitrary standalone files
aren't a use case in which we're heavily vested.
--
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
Re: JavaDoc parser [message #513740 is a reply to message #513522] |
Thu, 11 February 2010 03:00 |
|
Actually, many of the AST nodes your visitor will come across offer to return their JSDoc ranges; it's then up to you to either cast the IJSDoc object into something you can use, or read the documentation content from the buffer yourself. As for the issues with hover information, I'd need more reproducable steps--preferably in a bug report--to investigate. It's possible that the code responsible for converting your text selection into a resolvable element ran into trouble, as there may be some issues dealing with working copies in editors.
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
Powered by
FUDForum. Page generated in 0.03959 seconds