@@ -132,6 +132,7 @@ export class CompletionHandler {
132
132
provideCompletionsCommand ,
133
133
params
134
134
) ;
135
+ this . AdjustRoslynCompletionList ( roslynCompletions , delegatedCompletionParams . context . triggerCharacter ) ;
135
136
return roslynCompletions ;
136
137
}
137
138
@@ -198,4 +199,31 @@ export class CompletionHandler {
198
199
199
200
return CompletionHandler . emptyCompletionItem ;
200
201
}
202
+
203
+ private AdjustRoslynCompletionList ( completionList : CompletionList , triggerCharacter : string | undefined ) {
204
+ const data = completionList . itemDefaults ?. data ;
205
+ for ( const completionItem of completionList . items ) {
206
+ // textEdit is deprecated in favor of .range. Clear out its value to avoid any unexpected behavior.
207
+ completionItem . textEdit = undefined ;
208
+
209
+ if ( triggerCharacter === '@' && completionItem . commitCharacters ) {
210
+ // We remove `{`, '(', and '*' from the commit characters to prevent auto-completing the first
211
+ // completion item with a curly brace when a user intended to type `@{}` or `@()`.
212
+ completionItem . commitCharacters = completionItem . commitCharacters . filter (
213
+ ( commitChar ) => commitChar !== '{' && commitChar !== '(' && commitChar !== '*'
214
+ ) ;
215
+ }
216
+
217
+ // for intellicode items, manually set the insertText to avoid including stars in the commit
218
+ if ( completionItem . label . toString ( ) . includes ( '\u2605' ) ) {
219
+ if ( completionItem . textEditText ) {
220
+ completionItem . insertText = completionItem . textEditText ;
221
+ }
222
+ }
223
+
224
+ if ( ! completionItem . data ) {
225
+ completionItem . data = data ;
226
+ }
227
+ }
228
+ }
201
229
}
0 commit comments