mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 11:38:51 +01:00
Adding explicit returns
This commit is contained in:
@@ -40,6 +40,7 @@ class OutlineAdapter {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(TypeConverters.SymbolInformation.toOutlineEntry);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -64,7 +65,6 @@ class CodeLensAdapter {
|
||||
const doc = this._documents.getDocumentData(resource).document;
|
||||
|
||||
return asWinJsPromise(token => this._provider.provideCodeLenses(doc, token)).then(lenses => {
|
||||
|
||||
if (Array.isArray(lenses)) {
|
||||
return lenses.map(lens => {
|
||||
const id = this._heapService.keep(lens);
|
||||
@@ -74,6 +74,7 @@ class CodeLensAdapter {
|
||||
}, id);
|
||||
});
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -81,7 +82,7 @@ class CodeLensAdapter {
|
||||
|
||||
const lens = this._heapService.get<vscode.CodeLens>(ObjectIdentifier.of(symbol));
|
||||
if (!lens) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let resolve: TPromise<vscode.CodeLens>;
|
||||
@@ -118,6 +119,7 @@ class DefinitionAdapter {
|
||||
} else if (value) {
|
||||
return TypeConverters.location.from(value);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -141,6 +143,7 @@ class ImplementationAdapter {
|
||||
} else if (value) {
|
||||
return TypeConverters.location.from(value);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -162,7 +165,7 @@ class HoverAdapter {
|
||||
|
||||
return asWinJsPromise(token => this._provider.provideHover(doc, pos, token)).then(value => {
|
||||
if (!value) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
if (!value.range) {
|
||||
value.range = doc.getWordRangeAtPosition(pos);
|
||||
@@ -195,6 +198,7 @@ class DocumentHighlightAdapter {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(DocumentHighlightAdapter._convertDocumentHighlight);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -224,6 +228,7 @@ class ReferenceAdapter {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(TypeConverters.location.from);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -260,7 +265,7 @@ class QuickFixAdapter {
|
||||
|
||||
return asWinJsPromise(token => this._provider.provideCodeActions(doc, ran, { diagnostics: allDiagnostics }, token)).then(commands => {
|
||||
if (!Array.isArray(commands)) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
return commands.map((command, i) => {
|
||||
return <modes.CodeAction>{
|
||||
@@ -290,6 +295,7 @@ class DocumentFormattingAdapter {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(TypeConverters.TextEdit.from);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -313,6 +319,7 @@ class RangeFormattingAdapter {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(TypeConverters.TextEdit.from);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -338,6 +345,7 @@ class OnTypeFormattingAdapter {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(TypeConverters.TextEdit.from);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -363,6 +371,7 @@ class NavigateTypeAdapter implements IWorkspaceSymbolProvider {
|
||||
return ObjectIdentifier.mixin(result, id);
|
||||
});
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -378,6 +387,7 @@ class NavigateTypeAdapter implements IWorkspaceSymbolProvider {
|
||||
return value && TypeConverters.fromSymbolInformation(value);
|
||||
});
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,9 +407,8 @@ class RenameAdapter {
|
||||
let pos = TypeConverters.toPosition(position);
|
||||
|
||||
return asWinJsPromise(token => this._provider.provideRenameEdits(doc, pos, newName, token)).then(value => {
|
||||
|
||||
if (!value) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let result = <modes.WorkspaceEdit>{
|
||||
@@ -458,7 +467,7 @@ class SuggestAdapter {
|
||||
let list: CompletionList;
|
||||
if (!value) {
|
||||
// undefined and null are valid results
|
||||
return;
|
||||
return undefined;
|
||||
|
||||
} else if (Array.isArray(value)) {
|
||||
list = new CompletionList(value);
|
||||
@@ -523,7 +532,7 @@ class SuggestAdapter {
|
||||
private _convertCompletionItem(item: vscode.CompletionItem, position: vscode.Position, defaultRange: vscode.Range): modes.ISuggestion {
|
||||
if (!item.label) {
|
||||
console.warn('INVALID text edit -> must have at least a label');
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const result: modes.ISuggestion = {
|
||||
@@ -573,7 +582,7 @@ class SuggestAdapter {
|
||||
|
||||
if (!range.isSingleLine || range.start.line !== position.line) {
|
||||
console.warn('INVALID text edit -> must be single line and on the same line');
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -599,6 +608,7 @@ class SignatureHelpAdapter {
|
||||
if (value) {
|
||||
return TypeConverters.SignatureHelp.from(value);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -620,6 +630,7 @@ class LinkProviderAdapter {
|
||||
if (Array.isArray(links)) {
|
||||
return links.map(TypeConverters.DocumentLink.from);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -629,8 +640,10 @@ class LinkProviderAdapter {
|
||||
if (value) {
|
||||
return TypeConverters.DocumentLink.from(value);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user