AutoCompletion size

Questions on using RSyntaxTextArea should go here.

Moderator: robert

AutoCompletion size

Postby Nate » Sun Dec 06, 2009 1:29 pm

I can setDescriptionWindowSize, but can I set the list size? The list is a bit too small and I'd at least like the heights to match.

AutoCompletion rocks! :D
Nate
 
Posts: 15
Joined: Fri Dec 04, 2009 6:45 am

Re: AutoCompletion size

Postby robert » Sun Dec 06, 2009 5:45 pm

Good catch - I only added in setDescriptionWindowSize() because often the descriptions were pretty large, but never thought about doing the same thing for the choices list since it's often not too wide. Unfortunately there's nothing built-in to do this yet.

Feel free to hack it in yourself, or if you don't mind waiting I can add it to SVN quickly enough when I get a chance.

BTW - can't wait to see how your project is shaping up, sounds interesting - although I'm a PS guy myself. :D
User avatar
robert
 
Posts: 774
Joined: Sat May 10, 2008 5:16 pm

Re: AutoCompletion size

Postby Guest » Mon Dec 07, 2009 10:50 am

I just added a download tonight:
http://code.google.com/p/pg3b/
If you want to run on a non-Windows machine (though this is untested):
java -Djava.library.path=native -jar pg3b.jar
You may need a fully qualified path to the native directory.

It works even if you don't have the PG3B hardware. Eg, click Capture to activate the example config, then left click to play a song. :) Of course all the cool RSTA stuff is on the Scripts tab!

I originally bought an Xbox 360 just to play Street Fighter IV, so I chose the cheaper system. Plus the Xbox reportedly had more online players. The PG3B project might still apply to you though! PS3 peripherals work on the PC right? If you got an Xbox, you would be able to use your PS3 peripherals with the Xbox. :mrgreen:

The PG3B hardware itself isn't actually tied to Xbox. It may be possible to wire it up to a PS3 controller. However, the other owner on the PG3B project, Rick, is the EE genius, not me. Playing first person shooters with a keyboard and mouse is the only way to go!
Guest
 

Re: AutoCompletion size

Postby Nate » Mon Dec 07, 2009 11:08 am

BTW, I coded the PG3B UI from scratch in 7 days. 8-) And on the seventh day I completed my work which I had done, and I rested on the seventh day from all my work!
Nate
 
Posts: 15
Joined: Fri Dec 04, 2009 6:45 am

Re: AutoCompletion size

Postby robert » Thu Dec 10, 2009 4:54 am

I checked out your project and only fiddled with it for a little bit, but it looks good!

I played with the script editor the most (naturally) and saw that it wasn't allowing you to tab through the method parameters when you typed a '(' or selected a method name from the code completion list (btw, I'm calling this "parameter completion," is there a better name?). I dug into ScriptEditor.java and this looks to be happening because you're manually adding the squiggle underlines to the Highlighter yourself. RSTA adds custom highlights to the editor to facilitate code completion, so your "removeAll()" puts a kink in its plans.

I'd like to shamelessly plug the parser API already built into RSTA for this. You can call

Code: Select all
codeText.addParser(new MyParser());


where MyParser calls PnutsParser.parse() and handles adding squiggle-underlined errors if necessary. RSTA automagically calls into your parser whenever the document is modified, so you don't have to add a DocumentListener yourself.

Let me know if you are interested in going this route. This stuff isn't documented really (though AutoComplete isn't really documented either, but you seemed to figger that out just fine...), so I can send you a patch for ScriptEditor.java if you'd like to take a peek.
User avatar
robert
 
Posts: 774
Joined: Sat May 10, 2008 5:16 pm

Re: AutoCompletion size

Postby Guest » Mon Dec 14, 2009 10:35 am

Aha, that sounds like a sweet feature! :mrgreen: I will definitely go that route. A patch for ScriptEditor.java would be amazing, else I'll take a crack at it myself soon and post the results. :)
Guest
 

Re: AutoCompletion size

Postby robert » Mon Dec 14, 2009 1:17 pm

Okay, sent to the email you registered with on this forum.
User avatar
robert
 
Posts: 774
Joined: Sat May 10, 2008 5:16 pm

Re: AutoCompletion size

Postby Nate » Mon Dec 14, 2009 7:01 pm

Cool, thanks a lot for the patch! I applied your patch and changed how I do runtime errors to be a bit nicer:
http://code.google.com/p/pg3b/source/br ... ditor.java
Parameter completion is much nicer now. Parsing highlighting is very nice! :)

It would be a great addition to also have built-in support for arbitrary highlighting, like the runtime errors. Right now they differ from syntax errors in that they don't have a nice tooltip. I provide a tooltip for the message displayed under the RSTA though.
Nate
 
Posts: 15
Joined: Fri Dec 04, 2009 6:45 am

Re: AutoCompletion size

Postby robert » Wed Dec 16, 2009 9:16 pm

It would be a great addition to also have built-in support for arbitrary highlighting, like the runtime errors.


Aye, that's a good point. I'll add it to the unending to-do list. For the time being, you could also consider using line highlighting for runtime errors instead of the squiggle underlining. For example, highlight the line where the script fails with

Code: Select all
Object tag = textArea.addLineHighlight(int line, Color color);
...
textArea.removeLineHighlight(tag); // or textArea.removeAllLineHighlights();


Kind of like how a debugger might highlight the line the program is currently stopped at.

BTW, a method to size the completion list window has been pushed into SVN as well.

Code: Select all
AutoCompletion ac = ...;
ac.setChoicesWindowSize(width, height);
User avatar
robert
 
Posts: 774
Joined: Sat May 10, 2008 5:16 pm

Re: AutoCompletion size

Postby Nate » Wed Dec 23, 2009 3:57 am

Great stuff, thanks!
Nate
 
Posts: 15
Joined: Fri Dec 04, 2009 6:45 am


Return to Help

Who is online

Users browsing this forum: No registered users and 4 guests

cron