|
I'm using groovy1.1rc1 and jdk6u3 on winxp.
I was unable to reproduce this using JDK 5.12 on Win XP.
However, I got the exact same exception if I only selected this: Silly question, but are you sure the entire line was selected? If you were then I'll upgrade my JDK and try again. > but are you sure the entire line was selected?
I tried again and the issue exactly exists. I'm using jdk6u3 on winxp. Thanks, This looks like an intentional piece of code introduced by dierk. Basically, the scriptRun command is sensitive to the selected text. If there is no selection, all of the text is run. If there is a selection, only the selectoin is run,
This amounts to a feature that is poorly documented and in it's current form is of questionalble usability. My recommendation is to either (a) remove it or (b) make it explicit, add a Script->run and Script->run selected option (ctrl-R and ctrl-shift-R with ctrl-enter and ctrl-shift-enter as well, respectively). Assigning to Dierk since he was the initiator of the changed code for his opinion. Occasionally, I find this feature very useful. It allows to do some kind of poor-man's debugging of scripts as long as you work with the binding.
I don't agree with the view that it is 'poorly documented'. There isn't much to document and what needs to be said is available in http://groovy.codehaus.org/Groovy+Console Currently, I don't see any issue with this feature but I would be happy about any suggestion for improvement. The point is that a UI that appears simple and does something unexpected is something that should be avoided. When the unexpected behavior can be explained away by saying that it's documented somewhere raises a big usability red flag. Especially when it is an open source project and the referenced documentation is a €37 book.
How about my (b) option? Split this into a run and run selection option? Unless you object Dierk I will go ahead and implement that to address the usability issues, it fits in with some of the other usability quirks that have been changed. Split the run and run selected commands into two commands, with the shift key modifying the run into run selected in it's various key combinations.
|
||||||||||||||||||||||||||||||||||||||||||||
class Person { String name } Person person = new Person() person.name = "Daniel" println person.nameIf I select code
class Person { String name } Person person = new Person() person.name = "Daniel"and ctrl + enter to execute it.
Groovy Console complains:
groovy> class Person { groovy> String name groovy> }
groovy> Person person = new Person()
groovy> person.name = "Dan
Exception thrown: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script9: 5: unexpected char: 0xFFFF @ line 5, column 19.
1 error
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script9: 5: unexpected char: 0xFFFF @ line 5, column 19.
1 error