@@ -155,19 +155,23 @@ export class CompletionHandler {
155
155
) {
156
156
// TODO: Snippet support
157
157
158
- if ( delegatedCompletionItemResolveParams . originatingKind != LanguageKind . CSharp ) {
159
- return delegatedCompletionItemResolveParams . completionItem ;
160
- } else {
161
- const newItem = await vscode . commands . executeCommand < CompletionItem > (
162
- resolveCompletionsCommand ,
163
- delegatedCompletionItemResolveParams . completionItem
164
- ) ;
165
-
166
- if ( ! newItem ) {
158
+ try {
159
+ if ( delegatedCompletionItemResolveParams . originatingKind != LanguageKind . CSharp ) {
167
160
return delegatedCompletionItemResolveParams . completionItem ;
168
- }
161
+ } else {
162
+ const newItem = await vscode . commands . executeCommand < CompletionItem > (
163
+ resolveCompletionsCommand ,
164
+ delegatedCompletionItemResolveParams . completionItem
165
+ ) ;
169
166
170
- return newItem ;
167
+ if ( ! newItem ) {
168
+ return delegatedCompletionItemResolveParams . completionItem ;
169
+ }
170
+
171
+ return newItem ;
172
+ }
173
+ } catch ( error ) {
174
+ this . logger . logWarning ( `${ CompletionHandler . completionResolveEndpoint } failed with ${ error } ` ) ;
171
175
}
172
176
173
177
return CompletionHandler . emptyCompletionItem ;
@@ -180,33 +184,39 @@ export class CompletionHandler {
180
184
projectedPosition : Position ,
181
185
provisionalTextEdit ?: SerializableTextEdit
182
186
) {
183
- if ( provisionalTextEdit ) {
184
- // provisional C# completion
185
- return this . provideCSharpProvisionalCompletions ( triggerCharacter , virtualDocument , projectedPosition ) ;
186
- }
187
+ try {
188
+ if ( provisionalTextEdit ) {
189
+ // provisional C# completion
190
+ return this . provideCSharpProvisionalCompletions ( triggerCharacter , virtualDocument , projectedPosition ) ;
191
+ }
187
192
188
- // non-provisional C# completion
189
- const virtualDocumentUri = UriConverter . serialize ( virtualDocument . uri ) ;
190
- const params : CompletionParams = {
191
- context : {
192
- triggerKind : triggerKind ,
193
- triggerCharacter : triggerCharacter ,
194
- } ,
195
- textDocument : {
196
- uri : virtualDocumentUri ,
197
- } ,
198
- position : projectedPosition ,
199
- } ;
193
+ // non-provisional C# completion
194
+ const virtualDocumentUri = UriConverter . serialize ( virtualDocument . uri ) ;
195
+ const params : CompletionParams = {
196
+ context : {
197
+ triggerKind : triggerKind ,
198
+ triggerCharacter : triggerCharacter ,
199
+ } ,
200
+ textDocument : {
201
+ uri : virtualDocumentUri ,
202
+ } ,
203
+ position : projectedPosition ,
204
+ } ;
200
205
201
- const csharpCompletions = await vscode . commands . executeCommand < CompletionList > (
202
- provideCompletionsCommand ,
203
- params
204
- ) ;
205
- if ( ! csharpCompletions ) {
206
- return CompletionHandler . emptyCompletionList ;
206
+ const csharpCompletions = await vscode . commands . executeCommand < CompletionList > (
207
+ provideCompletionsCommand ,
208
+ params
209
+ ) ;
210
+ if ( ! csharpCompletions ) {
211
+ return CompletionHandler . emptyCompletionList ;
212
+ }
213
+ CompletionHandler . adjustCSharpCompletionList ( csharpCompletions , triggerCharacter ) ;
214
+ return csharpCompletions ;
215
+ } catch ( error ) {
216
+ this . logger . logWarning ( `${ CompletionHandler . completionEndpoint } failed with ${ error } ` ) ;
207
217
}
208
- CompletionHandler . adjustCSharpCompletionList ( csharpCompletions , triggerCharacter ) ;
209
- return csharpCompletions ;
218
+
219
+ return CompletionHandler . emptyCompletionList ;
210
220
}
211
221
212
222
// Provides 'provisional' C# completions.
0 commit comments