Open xiaoxstz opened 1 year ago
I have realized code completion according to the related document.
But I want the completion window to appear when I am typing, or after I press the Tab key.
Delete if (e.Text == ".") of the original code.
if (e.Text == ".")
void textEditor_TextArea_TextEntered(object sender, TextCompositionEventArgs e) { if (e.Text == ".") { // Open code completion after the user has pressed dot: completionWindow = new CompletionWindow(textEditor.TextArea); IList<ICompletionData> data = completionWindow.CompletionList.CompletionData; data.Add(new MyCompletionData("Item1")); data.Add(new MyCompletionData("Item2")); data.Add(new MyCompletionData("Item3")); completionWindow.Show(); completionWindow.Closed += delegate { completionWindow = null; }; } }
Then, the complete window will appear whatever I input. It's great!
However, if I input "It", and then choose "Item1" from the complete window. The content will turn to "IItem1"
Download the source code of this repository, and then you can find the related code in Window1.xaml.cs of the project ICSharpCode.AvalonEdit.Sample
Window1.xaml.cs
ICSharpCode.AvalonEdit.Sample
The original effect: Run the project and then input “.” in the text editor
Try to realize "completion when typing"
Delete if (e.Text == ".") in the function textEditor_TextArea_TextEntered in Window1.xaml.cs
textEditor_TextArea_TextEntered
I have realized code completion according to the related document.
But I want the completion window to appear when I am typing, or after I press the Tab key.
My try
Delete
if (e.Text == ".")
of the original code.Then, the complete window will appear whatever I input. It's great!
However, if I input "It", and then choose "Item1" from the complete window. The content will turn to "IItem1"
An easy way to reproduce it
Download the source code of this repository, and then you can find the related code in
Window1.xaml.cs
of the projectICSharpCode.AvalonEdit.Sample
The original effect: Run the project and then input “.” in the text editor
Try to realize "completion when typing"
Delete
if (e.Text == ".")
in the functiontextEditor_TextArea_TextEntered
inWindow1.xaml.cs