AvalonEdit代码完成 [英] AvalonEdit Code Completion

查看:95
本文介绍了AvalonEdit代码完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我目前正在使用AvalonEdit代码完成功能来执行简单的代码完成.本文向我们展示了如何通过插入用户输入的整个字符串来处理文本输入事件. IE.当用户按下."时,列表框将显示其中的项目,如果用户选择其中一个项目,则会插入整个字符串.我希望执行以下操作:当用户键入"item","i"的第一个单词时,它将显示列表框,在用户选择相应的项目后,将插入适当的字符串"item"的"iitem".

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?

推荐答案

CompletionWindow类具有属性StartOffsetEndOffset,这些属性控制将文档文本的哪一部分视为"当前单词".

因此,基本上,如果您已经在插入"i"之后打开CompletionWindow,那么您要做的就是:
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:
completionWindow.StartOffset -= 1;


这篇关于AvalonEdit代码完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆