AutoComplete does not replace the whole word

General Discussion on RSyntaxTextArea.

Moderator: robert

AutoComplete does not replace the whole word

Postby schlm3@gmail.com » Fri Sep 13, 2013 2:56 pm

Hi
I noticed the following behavior in AutoCompletion.java:
I have written Autocompletion for XPath expressions.
If the user enters an XPath like "Store/Items/Books", then presses "Ctrl-Space" while the cursor is at the end of the XPath, performing an autocomplete replaces the "Books" correctly.
If on the other hand, the cursor is between B and o while performing the autocomplete, the autocomplete only replaces the "B" with the new word and the "ooks" remains at the end, thus getting for example "Store/Items/Bananasooks".

I wonder if the current behavior is the behavior you have expected, since it does not behave like - for example - eclipse.

I have found the method AutoCompletion.insertCompletion(..) to be the source of this and changed the behavior for my implementation in a subclass of AutoCompletion. Unfortunately this implementation does not integrate with the framework very well, since it requires the use of the "isValidChar(char ch)" method from my custom completion implementation. If you are interested, I could provide you with a proposal for AutoCompletion which adds a "replaceTypedWord" option. However it would require an additional method in the "CompletionProvider" interface and changing all implementors would be out of scope for me.

With kind regards,
Markus
schlm3@gmail.com
 
Posts: 3
Joined: Fri Sep 06, 2013 11:56 am

Re: AutoComplete does not replace the whole word

Postby robert » Sat Sep 14, 2013 2:35 am

Yes, the behavior your describe is ow things are currently implemented. Feel free to send a patch or merge request.
User avatar
robert
 
Posts: 802
Joined: Sat May 10, 2008 5:16 pm

Re: AutoComplete does not replace the whole word

Postby as3boyan » Mon Sep 16, 2013 8:24 pm

You know, many IDEs do this in same way.
as3boyan
 
Posts: 19
Joined: Mon Sep 16, 2013 8:21 pm


Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron