Click here to Skip to main content
14,975,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I am current using the AvalonEdit Code Completion to perform a simple code completion. The article shows us how to handle the text entering event by inserting the whole string entered by user. I.e. when user pressed ".", list box will show the items inside, if the user choosed one of the item there, the whole string will be inserted. I wish to perform the completion whereby when user keys in for example the first word of the "item", "i", it will show the list box, after the user selects the corresponding item, proper string "item" will be inserted instead of "iitem". Is it possible to do that?
Posted

1 solution

The CompletionWindow class has properties StartOffset and EndOffset that control which part of the document text is considered to be the 'current word'.

So basically, if you are opening the CompletionWindow after the "i" is already inserted, all you need to do is:
C#
completionWindow.StartOffset -= 1;
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900