File tree 1 file changed +15
-4
lines changed
src/AvaloniaEdit/CodeCompletion
1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,12 @@ public class CompletionList : TemplatedControl
38
38
public CompletionList ( )
39
39
{
40
40
DoubleTapped += OnDoubleTapped ;
41
+
42
+ CompletionAcceptKeys = new [ ]
43
+ {
44
+ Key . Enter ,
45
+ Key . Tab ,
46
+ } ;
41
47
}
42
48
43
49
@@ -103,6 +109,11 @@ public CompletionListBox ListBox
103
109
}
104
110
}
105
111
112
+ /// <summary>
113
+ /// Gets or sets the array of keys that are supposed to request insertation of the completion
114
+ /// </summary>
115
+ public Key [ ] CompletionAcceptKeys { get ; set ; }
116
+
106
117
/// <summary>
107
118
/// Gets the scroll viewer used in this list box.
108
119
/// </summary>
@@ -163,13 +174,13 @@ public void HandleKey(KeyEventArgs e)
163
174
e . Handled = true ;
164
175
_listBox . SelectIndex ( _listBox . ItemCount - 1 ) ;
165
176
break ;
166
- case Key . Tab :
167
- case Key . Enter :
168
- if ( CurrentList . Count > 0 )
177
+ default :
178
+ if ( CompletionAcceptKeys . Contains ( e . Key ) && CurrentList . Count > 0 )
169
179
{
170
180
e . Handled = true ;
171
181
RequestInsertion ( e ) ;
172
- }
182
+ }
183
+
173
184
break ;
174
185
}
175
186
}
You can’t perform that action at this time.
0 commit comments