How to use Kiwi Scrap?
So far I was using Scrappy for yuick calculations and algorithm
prototyping. The only thing I'm missing is capturing of the System.out
and System.err streams. I have noticed that KS says that it builds on
Scrappy and adds new features, but when I tried to run it I couldn't
even make it instantiate a simple object...
e.g. when I enter the statement: new java.util.Date();
I can print it, inspect it and run it in Scrappy. Kiwi Scrap tells me
that it's not a valid expression.
It would be well appreciated if the author could a list of the new
features and perhaps some short tutorial.
TIA,
Dimitar
Please sign in to leave a comment.
In KiwiScrap you have 2 execution modes:
1) Run - The code snippet will be wrapped in a method without a return value. For outputs to the console you can use the always available variable out of the type PrintWriter.
2) Evaluate - The code snippet will be wrapped in a method with a return value. The last line will be considered as return statement and must therefore contain a expression.
Example:
1)
Use 'Run' to execute this snippet. 'Evaluate' will create an error.
2)
Use 'Evaluate' to execute this snippet. 'Run' will complain about the missing ';'.
Great! Could you add this as a small help dialog in the next release?
BTW, if you do this, you can mention there is one more mode - "Inspect"
works just like "Evaluate", but it gives you the results in a bean
inspector.
On a side note, a very usefull feature would be if the OpenAPI allows to
use the native IDEA inspector (this would give us access to the new
debugger views)
cheers,
Dimitar
Stefan Stiller wrote:
I'm using kiwiscrap 1.2 plugin in IntelliJ 4.5
I tried both the options (run & evaluate) without any success.
Running the following
out.println(new java.util.Date());
gives the error
Compiling error: $Test:1: expected (source unavailable) 1 error Evaluating the same gives following error: Compiling error: $Test:1: expected (source unavailable) $Test:2: ')' expected (source unavailable) $Test:2: illegal start of expression (source unavailable) $Test:2: 'void' type not allowed here (source unavailable) 4 errors Evaluating new java.util.Date() gives Compiling error: $Test:1: expected (source unavailable) 1 error ]]>
Please let me know what am I doing wrong.
It looks like you used the keyword 'import' in the Main Imports or
Imports field. The import fields must only contain a comma separate
list of packages or classes but not the keyword itself.
Bye,
Stefan.
Karthikeyan wrote:
It works!!! Thanks a lot!
Is there any documents available for this tool? Is the source code open & if yes, where can I download them?
Thanks again for the help.
There is currently no documentation available. I will add something if I
have time.
The source code is bundle with the plugin. See file src.zip in folder
<IDEA-HOME>\plugins\ks-scrap.
Bye,
Stefan.
Karthikeyan wrote: