mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
Adding more explicit returns
This commit is contained in:
@@ -168,6 +168,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
|
||||
if (Array.isArray(result)) {
|
||||
return <vscode.Diagnostic[]>Object.freeze(result.slice(0));
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
has(uri: URI): boolean {
|
||||
|
||||
@@ -456,5 +456,6 @@ export class ExtHostDocumentData extends MirrorModel2 {
|
||||
if (wordAtText) {
|
||||
return new Range(position.line, wordAtText.startColumn - 1, position.line, wordAtText.endColumn - 1);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,7 @@ class ExtensionStoragePath {
|
||||
if (this._value) {
|
||||
return paths.join(this._value, extension.id);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
private _getOrCreateWorkspaceStoragePath(): TPromise<string> {
|
||||
@@ -311,6 +312,7 @@ export class ExtHostExtensionService extends AbstractExtensionService<ExtHostExt
|
||||
if (errors[1]) {
|
||||
return TPromise.wrapError(errors[1]);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ export class ExtHostMessageService {
|
||||
if (typeof handle === 'number') {
|
||||
return commands[handle];
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ export class ExtHostQuickOpen extends ExtHostQuickOpenShape {
|
||||
if (typeof handle === 'number') {
|
||||
return items[handle];
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}, (err) => {
|
||||
this._proxy.$setError(err);
|
||||
@@ -109,5 +110,6 @@ export class ExtHostQuickOpen extends ExtHostQuickOpenShape {
|
||||
if (this._validateInput) {
|
||||
return TPromise.as(this._validateInput(input));
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ function getIconPath(decorations: vscode.SCMResourceThemableDecorations) {
|
||||
} else if (decorations.iconPath) {
|
||||
return `${decorations.iconPath}`;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export interface Cache {
|
||||
|
||||
@@ -111,7 +111,7 @@ export function fromViewColumn(column?: vscode.ViewColumn): EditorPosition {
|
||||
|
||||
export function toViewColumn(position?: EditorPosition): vscode.ViewColumn {
|
||||
if (typeof position !== 'number') {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
if (position === EditorPosition.ONE) {
|
||||
return <number>types.ViewColumn.One;
|
||||
@@ -120,6 +120,7 @@ export function toViewColumn(position?: EditorPosition): vscode.ViewColumn {
|
||||
} else if (position === EditorPosition.THREE) {
|
||||
return <number>types.ViewColumn.Three;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function isDecorationOptions(something: any): something is vscode.DecorationOptions {
|
||||
|
||||
@@ -279,7 +279,7 @@ export class Range {
|
||||
// this happens when there is no overlap:
|
||||
// |-----|
|
||||
// |----|
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
return new Range(start, end);
|
||||
}
|
||||
@@ -937,6 +937,7 @@ export namespace TextEditorSelectionChangeKind {
|
||||
case 'mouse': return TextEditorSelectionChangeKind.Mouse;
|
||||
case 'api': return TextEditorSelectionChangeKind.Command;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export class MainThreadCommands extends MainThreadCommandsShape {
|
||||
this._disposables[id].dispose();
|
||||
delete this._disposables[id];
|
||||
}
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
$executeCommand<T>(id: string, args: any[]): Thenable<T> {
|
||||
|
||||
@@ -152,6 +152,7 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
return workbenchEditor.position;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
private _getTextEditorPositionData(): ITextEditorPositionData {
|
||||
@@ -183,9 +184,8 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
};
|
||||
|
||||
return this._workbenchEditorService.openEditor(input, position).then(editor => {
|
||||
|
||||
if (!editor) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const findEditor = (): string => {
|
||||
@@ -196,6 +196,7 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const syncEditorId = findEditor();
|
||||
@@ -238,6 +239,7 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
options: { preserveFocus: false }
|
||||
}, position).then(() => { return; });
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
$tryHideEditor(id: string): TPromise<void> {
|
||||
@@ -253,6 +255,7 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
$trySetSelections(id: string, selections: ISelection[]): TPromise<any> {
|
||||
@@ -276,6 +279,7 @@ export class MainThreadEditors extends MainThreadEditorsShape {
|
||||
return TPromise.wrapError('TextEditor disposed');
|
||||
}
|
||||
this._textEditorsMap[id].revealRange(range, revealType);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
$trySetOptions(id: string, options: ITextEditorConfigurationUpdate): TPromise<any> {
|
||||
|
||||
@@ -51,6 +51,7 @@ export class MainThreadQuickOpen extends MainThreadQuickOpenShape {
|
||||
if (item) {
|
||||
return item.handle;
|
||||
}
|
||||
return undefined;
|
||||
}, undefined, progress => {
|
||||
if (progress) {
|
||||
this._proxy.$onItemSelected((<MyQuickPickItems>progress).handle);
|
||||
|
||||
@@ -143,7 +143,7 @@ class FormatOnSaveParticipant implements INamedSaveParticpant {
|
||||
const model = editorModel.textEditorModel;
|
||||
if (env.reason === SaveReason.AUTO
|
||||
|| !this._configurationService.lookup('editor.formatOnSave', model.getLanguageIdentifier().language).value) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const versionNow = model.getVersionId();
|
||||
@@ -180,6 +180,7 @@ class FormatOnSaveParticipant implements INamedSaveParticpant {
|
||||
return [new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn)];
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -212,6 +213,7 @@ class ExtHostSaveParticipant implements INamedSaveParticpant {
|
||||
return TPromise.wrapError('listener failed');
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}).then(resolve, reject);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user