mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 19:59:37 +00:00
Reducing scope of try catch to just exec
We want to be alerted if an exception is thrown outside of execute
This commit is contained in:
@@ -364,14 +364,14 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider
|
||||
]
|
||||
};
|
||||
|
||||
let response: Proto.CompletionDetailsResponse;
|
||||
let details: Proto.CompletionEntryDetails[] | undefined;
|
||||
try {
|
||||
response = await this.client.execute('completionEntryDetails', args, token);
|
||||
const response = await this.client.execute('completionEntryDetails', args, token);
|
||||
details = response.body;
|
||||
} catch {
|
||||
return item;
|
||||
}
|
||||
|
||||
const details = response.body;
|
||||
if (!details || !details.length || !details[0]) {
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -26,18 +26,21 @@ class TypeScriptDocumentHighlightProvider implements vscode.DocumentHighlightPro
|
||||
}
|
||||
|
||||
const args = typeConverters.Position.toFileLocationRequestArgs(file, position);
|
||||
let items: Proto.OccurrencesResponseItem[] | undefined;
|
||||
try {
|
||||
const response = await this.client.execute('occurrences', args, token);
|
||||
if (response && response.body) {
|
||||
return response.body
|
||||
.filter(x => !x.isInString)
|
||||
.map(documentHighlightFromOccurance);
|
||||
}
|
||||
items = response.body;
|
||||
} catch {
|
||||
// noop
|
||||
}
|
||||
|
||||
return [];
|
||||
if (!items) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return items
|
||||
.filter(x => !x.isInString)
|
||||
.map(documentHighlightFromOccurance);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,17 +140,18 @@ class TypeScriptRefactorProvider implements vscode.CodeActionProvider {
|
||||
await this.formattingOptionsManager.ensureConfigurationForDocument(document, undefined);
|
||||
|
||||
const args: Proto.GetApplicableRefactorsRequestArgs = typeConverters.Range.toFileRangeRequestArgs(file, rangeOrSelection);
|
||||
let response: Proto.GetApplicableRefactorsResponse;
|
||||
let refactorings: Proto.ApplicableRefactorInfo[];
|
||||
try {
|
||||
response = await this.client.execute('getApplicableRefactors', args, token);
|
||||
if (!response || !response.body) {
|
||||
const response = await this.client.execute('getApplicableRefactors', args, token);
|
||||
if (!response.body) {
|
||||
return undefined;
|
||||
}
|
||||
refactorings = response.body;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return this.convertApplicableRefactors(response.body, document, file, rangeOrSelection);
|
||||
return this.convertApplicableRefactors(refactorings, document, file, rangeOrSelection);
|
||||
}
|
||||
|
||||
private convertApplicableRefactors(
|
||||
|
||||
Reference in New Issue
Block a user