Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » JavaScript
JavaScript [message #148471] Wed, 23 November 2005 09:55 Go to next message
Eclipse UserFriend
Originally posted by: harald.albrecht.plt.rwth-aachen.de

I have a question concerning the Outline view when editing JavaScript:

So far, the outline shows all functions on the outmost level, as well as
variables (var xxx = ...) within these functions and variables on the
outmost level.

However, the outline skips typical JS idioms, such as defining the
prototype and defining methods on the prototype (at least I think that
they are typical, but YMMV). In particular, object initializers are
completely ignored. For instance:

function FOO() {
}

FOO.prototype = {
bar: function() = {},
baz: function() = {}
}

Is someone already thinking about tackling this issue. Since I have to
experience in hacking Eclipse: where should I start looking at when I want
to add proper parsing for the aforementioned object initializers in order
to make them appear in the outline view?

Any help greatly appreciated!
-- Harald
Re: JavaScript [message #148544 is a reply to message #148471] Wed, 23 November 2005 16:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: joakim.bindows.net

There are several bugs regarding this in Bugzilla but I don't think that
anybody is working on them. The JavaScript editor has hardly changed at all
in a long time and it seems quite dead to me since it's missing most of the
nice features that all the other editors have.

Regards
Joakim

"Harald Albrecht" <harald.albrecht@plt.rwth-aachen.de> wrote in message
news:28abe16acbab2ece0521f317f4e79fab$1@www.eclipse.org...
>I have a question concerning the Outline view when editing JavaScript:
>
> So far, the outline shows all functions on the outmost level, as well as
> variables (var xxx = ...) within these functions and variables on the
> outmost level.
>
> However, the outline skips typical JS idioms, such as defining the
> prototype and defining methods on the prototype (at least I think that
> they are typical, but YMMV). In particular, object initializers are
> completely ignored. For instance:
>
> function FOO() {
> }
>
> FOO.prototype = {
> bar: function() = {},
> baz: function() = {}
> }
>
> Is someone already thinking about tackling this issue. Since I have to
> experience in hacking Eclipse: where should I start looking at when I want
> to add proper parsing for the aforementioned object initializers in order
> to make them appear in the outline view?
>
> Any help greatly appreciated!
> -- Harald
>
Re: JavaScript [message #148573 is a reply to message #148544] Wed, 23 November 2005 17:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harald.albrecht.plt.rwth-aachen.de

Hello Joakim,

thank you for answering. Doesn't sound too much encouraging after all.

I looked into the CVS tree but wasn't able to find the lexical
specification for the parser and scanner, albeit the source files carry
notes that they have been created using SableCC. Do you have an idea where
the JavaScript lexical definitions and grammar can be found?

Thank you very much,
Harald

Joakim Andersson wrote:
> There are several bugs regarding this in Bugzilla but I don't think that
> anybody is working on them. The JavaScript editor has hardly changed at all
> in a long time and it seems quite dead to me since it's missing most of the
> nice features that all the other editors have.
Re: JavaScript [message #148605 is a reply to message #148573] Wed, 23 November 2005 18:13 Go to previous messageGo to next message
David Williams is currently offline David WilliamsFriend
Messages: 722
Registered: July 2009
Senior Member
On Wed, 23 Nov 2005 12:21:03 -0500, Harald Albrecht <harald.albrecht@plt=
..rwth-aachen.de> wrote:

>
> I looked into the CVS tree but wasn't able to find the lexical
> specification for the parser and scanner, albeit the source files carr=
y
> notes that they have been created using SableCC. Do you have an idea w=
here
> the JavaScript lexical definitions and grammar can be found?
>

Yes, we have not included the original SableCC "spec", the reason being =
is
the original author (not me! :) said that they "hand modified" the gener=
ated
code so much, that it no longer resembled the perser generator version a=
nd
could not really be re-generated. And, if we every "re-did" it, we would=
n't
want to use SableCC.

This hand tweaking is of course a bad practice, and one enhancement, amo=
ng many, would
be to "clean up" the java script parser, even recreate it?!, as well as
add "object oriented" functionality you mentioned.

We've mentioned before we have no plans to enhance the javascript editor=
much,
just due to not-enough-people-to-do-everything and would most welcome
participation from the larger community. Of course,
we know its no small task. We've had some interest expressed, but no
committments.
Re: JavaScript [message #148846 is a reply to message #148605] Thu, 24 November 2005 08:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harald.albrecht.plt.rwth-aachen.de

David Williams wrote:
> Yes, we have not included the original SableCC "spec", the reason being is
> the original author (not me! :) said that they "hand modified" the generated
> code so much, that it no longer resembled the perser generator version and
> could not really be re-generated. And, if we every "re-did" it, we wouldn't
> want to use SableCC.

In the past I had worked with JFlex in the RemoteTea ONC/RPC project when
developping a Java-based rpcgen protocol compiler. My impression is that
JFlex is easy to use, you write the grammar and embed Java code into the
rules in order to create your object tree representing the information
retrieved.

Since I'm new to Eclipse plugins: I currently do not understand how the
parser is activated, especially in view of the user typing some new text
somewhere in his file. You surely don't want to reparse the whole thing
over and over again? If incremental parsing would be required, would it
then make sense to write a hand-made parser?

Thanks,
Harald
Re: JavaScript [message #149201 is a reply to message #148846] Fri, 25 November 2005 16:13 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

Harald Albrecht wrote:
> In the past I had worked with JFlex in the RemoteTea ONC/RPC project
> when developping a Java-based rpcgen protocol compiler. My impression is
> that JFlex is easy to use, you write the grammar and embed Java code
> into the rules in order to create your object tree representing the
> information retrieved.

You'll find that the CSS, DTD, XML, and JSP source parsers used by
the editors in WTP were all written using JFlex.

> Since I'm new to Eclipse plugins: I currently do not understand how the
> parser is activated, especially in view of the user typing some new text
> somewhere in his file. You surely don't want to reparse the whole thing
> over and over again? If incremental parsing would be required, would it
> then make sense to write a hand-made parser?

The JSEditor does activate reparsing based on changes to the text.
Changes trigger JFace DocumentEvents and the JSLineStyleListener
tries to reparse incrementally to keep the syntax coloring up to
date. A seperate call is made to update the outline view. As David
pointed out earlier, we would *greatly* welcome participation from
the larger community of contributors to improve the JavaScript editor.

--
- Nitin


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:Dependent Projects
Next Topic:Datasource with M9
Goto Forum:
  


Current Time: Fri Apr 26 11:29:04 GMT 2024

Powered by FUDForum. Page generated in 0.03439 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top