Language API and breakpoints

I want to set breakpoints in my JavaScript code.

I know IJ is not and may never be a JavaScript debugger and I am not
really expecting it to be (attaching to IE, Gecko, and other browsers,
etc. i.e. a lot of headache).

But it would be nice, especially in the case of JavaScript, where one
has the "debugger" statement for breaking even in anonymous code blocks,
that the breakpoint UI could be routed to use it.

For example:
- When the user asks to add a breakpoint, the code could get a
"debugger;" line.
- When the user writes the debugger directive IntelliJ will realize (and
mark in the gutter) that a breakpoint exists there.
- I can even see conditional breakpoints happening, where the debugger
statement will be put in a conditional statement, but that a second order.

My point is that right now (since the IDE and debugger are 2 different
tools) using debugger breakpoints is in many cases not as straight
forward as using the debugger statement, but now I have to manage my
breakpoints myself (by searching for "debugger", attaching a special
TODO comment and pattern to breakpoints, etc.) which I don't like.

Comments?

Regards,
Amnon

14 comments
Comment actions Permalink

Amnon I. Govrin wrote:

I want to set breakpoints in my JavaScript code.

I know IJ is not and may never be a JavaScript debugger and I am not
really expecting it to be (attaching to IE, Gecko, and other browsers,
etc. i.e. a lot of headache).

But it would be nice, especially in the case of JavaScript, where one
has the "debugger" statement for breaking even in anonymous code blocks,
that the breakpoint UI could be routed to use it.

For example:
- When the user asks to add a breakpoint, the code could get a
"debugger;" line.
- When the user writes the debugger directive IntelliJ will realize (and
mark in the gutter) that a breakpoint exists there.
- I can even see conditional breakpoints happening, where the debugger
statement will be put in a conditional statement, but that a second order.

My point is that right now (since the IDE and debugger are 2 different
tools) using debugger breakpoints is in many cases not as straight
forward as using the debugger statement, but now I have to manage my
breakpoints myself (by searching for "debugger", attaching a special
TODO comment and pattern to breakpoints, etc.) which I don't like.

Comments?

Regards,
Amnon


Well, I guess I'm the only freak doing this :)

Amnon

0
Comment actions Permalink

Well, I guess I'm the only freak doing this :)

No, you are not alone :).
I'm still struggling to really understand that LanguageAPI - but even with
the sources for the JavaScriptPlug-in, I can't.
For debugging, I'm studying Rhino to see if it could be used somehow for
"non Browser" javascript debugging.
For browser based debugging, JRex seems the best bridge so far.
These two frameworks are not the problem, but that LanguageAPI :) - or is
just me that I don't understand how IDEA works, or is supposed to work.
I experimented with the Javascript plug-in for Eclipse, and I have no problems
to integrated there - but I don't want Eclipse :).

JavaScript seems to some sort of stepchild for JetBrains :(.

Ahmed.
P.S. This LanguageAPI could be so good to have plug-ins for Velocity,Freemarker,
and MVC frameworks config files, but so far, I don't understand it.

0
Comment actions Permalink

Hi,

Any particular questions?

Ahmed Mohombe wrote:
>> Well, I guess I'm the only freak doing this :)


No, you are not alone :).
I'm still struggling to really understand that LanguageAPI - but even
with the sources for the JavaScriptPlug-in, I can't.
For debugging, I'm studying Rhino to see if it could be used somehow for
"non Browser" javascript debugging.
For browser based debugging, JRex seems the best bridge so far.
These two frameworks are not the problem, but that LanguageAPI :) - or
is just me that I don't understand how IDEA works, or is supposed to work.
I experimented with the Javascript plug-in for Eclipse, and I have no
problems to integrated there - but I don't want Eclipse :).

JavaScript seems to some sort of stepchild for JetBrains :(.

Ahmed.
P.S. This LanguageAPI could be so good to have plug-ins for
Velocity,Freemarker, and MVC frameworks config files, but so far, I
don't understand it.



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

It might be awhile until comprehensive documentation for all the API appears.
Though I probably could answer any specific questions that may come up. So
what's most unclear there?

-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

>> Well, I guess I'm the only freak doing this :)
>>

No, you are not alone :).
I'm still struggling to really understand that LanguageAPI - but even
with
the sources for the JavaScriptPlug-in, I can't.
For debugging, I'm studying Rhino to see if it could be used somehow
for
"non Browser" javascript debugging.
For browser based debugging, JRex seems the best bridge so far.
These two frameworks are not the problem, but that LanguageAPI :) - or
is
just me that I don't understand how IDEA works, or is supposed to
work.
I experimented with the Javascript plug-in for Eclipse, and I have no
problems
to integrated there - but I don't want Eclipse :).
JavaScript seems to some sort of stepchild for JetBrains :(.

Ahmed.
P.S. This LanguageAPI could be so good to have plug-ins for
Velocity,Freemarker,
and MVC frameworks config files, but so far, I don't understand it.




0
Comment actions Permalink

It might be awhile until comprehensive documentation for all the API
appears. Though I probably could answer any specific questions that
may come up. So what's most unclear there?

Thank you for your quick reply.

My biggest problem is that I don't get the picture in IDEA. Is like programming
in the dark - or this infinite try and error way.
I would have a lot of small qustions, but they are because I don't understand
the entire:
- how to control the Parser (not just the lexer)
- how to do custom methods completion
- how to do "smart completions"
- how to connect codelines/method scopes to other elements(for jumping from,
and to that scope/code line)
- how to mix snipets (e.g. velocity with HTML) and get both advantages: some
sort of bridge like the one for JavaScript/Html
- how to see more files as one - when editing and viewing, but not as virtual
File (e.g. for the XDoclet fragments, and the struts.Tiles)

So there are too many questions IMHO from my side, and other users have too
many questions as well.
IMHO the best solution would be a some nice articles published on Onboard.jetbrains,
to explain the big picture.

Thank you,

Ahmed.



0
Comment actions Permalink

:)
Big wishlist do you have any code snippets already? Or you just teach Language API without coding?

TIA,
Dmitry

0
Comment actions Permalink

Big wishlist

I missed somehow the Christmas :).

do you have any code snippets already?

Yes I (we) do, but as I said, not the snipets and the details are the problem,
but the entire picture(for the most of the most of the team).
Our previous two projects were shifted on Eclipse because the feasibility
study on IDEA was not convincing enough for the management.
I was just trying to avoid this for the next project, but than I will need
to fight the "argument" that "we already have a lot of knowhow" on Eclipse
:).

Or you just teach
Language API without coding?

I don't teach, and I'm far from teaching IDEA/OpenAPI. I'm just learning
myself, and of course with code - how else.

Ahmed.

0
Comment actions Permalink

I'm asking you cause your questions related not Language API itself but global IDEA concepts such as PSI and other APIs.
If you want get concrete answers ask more specific questions :)

TIA,
Dmitry

0
Comment actions Permalink

For me the very open points are (I did not find any starting point):
- how can I hook into the code completion?
- how to support "goto xxx"
I don't need full fledged example code but just an hint where to start.

Sven

Dmitry Kashin schrieb:

I'm asking you cause your questions related not Language API itself but global IDEA concepts such as PSI and other APIs.
If you want get concrete answers ask more specific questions :)

TIA,
Dmitry

0
Comment actions Permalink

Hi,

If you provide reference for psi element located under cursor then
during complete and goto def the reference will be queried for
completion variants (PsiReference::getVariants()) and its target
(PsiReference::resolve())

Sven Steiniger wrote:

For me the very open points are (I did not find any starting point):
- how can I hook into the code completion?
- how to support "goto xxx"
I don't need full fledged example code but just an hint where to start.

Sven

Dmitry Kashin schrieb:

>> I'm asking you cause your questions related not Language API itself
>> but global IDEA concepts such as PSI and other APIs. If you want get
>> concrete answers ask more specific questions :)
>>
>> TIA,
>> Dmitry


--
Maxim Mossienko
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Hi,

I'm new to JRex. I have a doubt. Can Jrex be used as a plugin to eclipse?

Thanks and regards,
mrc

0
Comment actions Permalink

I'm new to JRex. I have a doubt. Can Jrex be used as a plugin
to eclipse?

JRex is not a plug-in, but a "Java Bridge" to the Mozilla engine.
I didn't said "to use it as a plug-in" but "in a plug-in", independently
if that is Eclipse or IntelliJ.
JRex seems the only way at the moment to rander HTML/javascript/CSS in java
in a correct manner, since the JHtmlPane is a total old trash.

Ahmed.

0
Comment actions Permalink

On Tue, 15 Mar 2005 09:28:49 +0000, Ahmed Mohombe wrote:

JRex seems the only way at the moment to rander HTML/javascript/CSS in
java in a correct manner, since the JHtmlPane is a total old trash.


Doesn't the JDNC project embed Mozilla/Internet Explorer in java apps as
well?

There is WebRenderer, which looks like it renders pretty damn nicely, but
its commercial :(

0
Comment actions Permalink

>> JRex seems the only way at the moment to rander HTML/javascript/CSS
>> in java in a correct manner, since the JHtmlPane is a total old
>> trash.
>>

Doesn't the JDNC project embed Mozilla/Internet Explorer in java apps
as well?

It's not just about simply embeding a browser, but more about interacting
in a simply manner with the DOM and the events from Java(without writting
XPIs). We used JRex in may other projects, and it was pretty good.
Just because JDIC now offers too some sort of "embeding", doesn't mean that
it's usable to interact with the browser :).

Ahmed.


0

Please sign in to leave a comment.