diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index 9e6f4b34798..661f5cf5e86 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -647,7 +647,7 @@ export function createApiFactory( // namespace: scm const scm: typeof vscode.scm = { get inputBox() { - return extHostSCM.getLastInputBox(extension); + return extHostSCM.getLastInputBox(extension)!; // Strict null override - Deprecated api }, createSourceControl(id: string, label: string, rootUri?: vscode.Uri) { return extHostSCM.createSourceControl(extension, id, label, rootUri); @@ -859,7 +859,7 @@ class Extension implements vscode.Extension { get exports(): T { if (this.packageJSON.api === 'none') { - return undefined; + return undefined!; // Strict nulloverride - Public api } return this._extensionService.getExtensionExports(this._identifier); } diff --git a/src/vs/workbench/api/node/extHost.protocol.ts b/src/vs/workbench/api/node/extHost.protocol.ts index 9b9f34f91ee..00eb6e73112 100644 --- a/src/vs/workbench/api/node/extHost.protocol.ts +++ b/src/vs/workbench/api/node/extHost.protocol.ts @@ -527,7 +527,7 @@ export interface ExtHostUrlsShape { } export interface MainThreadWorkspaceShape extends IDisposable { - $startFileSearch(includePattern: string | undefined, includeFolder: UriComponents | undefined, excludePatternOrDisregardExcludes: string | false | undefined, maxResults: number, token: CancellationToken): Promise; + $startFileSearch(includePattern: string | undefined, includeFolder: UriComponents | undefined, excludePatternOrDisregardExcludes: string | false | undefined, maxResults: number | undefined, token: CancellationToken): Promise; $startTextSearch(query: IPatternInfo, options: ITextQueryBuilderOptions, requestId: number, token: CancellationToken): Promise; $checkExists(includes: string[], token: CancellationToken): Promise; $saveAll(includeUntitled?: boolean): Promise; @@ -1105,11 +1105,11 @@ export interface ExtHostProgressShape { export interface ExtHostCommentsShape { $provideDocumentComments(handle: number, document: UriComponents): Promise; - $createNewCommentThread(handle: number, document: UriComponents, range: IRange, text: string): Promise; + $createNewCommentThread(handle: number, document: UriComponents, range: IRange, text: string): Promise; $onCommentWidgetInputChange(commentControllerHandle: number, input: string): Promise; $provideCommentingRanges(commentControllerHandle: number, uriComponents: UriComponents, token: CancellationToken): Promise; $createNewCommentWidgetCallback(commentControllerHandle: number, uriComponents: UriComponents, range: IRange, token: CancellationToken): void; - $replyToCommentThread(handle: number, document: UriComponents, range: IRange, commentThread: modes.CommentThread, text: string): Promise; + $replyToCommentThread(handle: number, document: UriComponents, range: IRange, commentThread: modes.CommentThread, text: string): Promise; $editComment(handle: number, document: UriComponents, comment: modes.Comment, text: string): Promise; $deleteComment(handle: number, document: UriComponents, comment: modes.Comment): Promise; $startDraft(handle: number, document: UriComponents): Promise; @@ -1117,7 +1117,7 @@ export interface ExtHostCommentsShape { $finishDraft(handle: number, document: UriComponents): Promise; $addReaction(handle: number, document: UriComponents, comment: modes.Comment, reaction: modes.CommentReaction): Promise; $deleteReaction(handle: number, document: UriComponents, comment: modes.Comment, reaction: modes.CommentReaction): Promise; - $provideWorkspaceComments(handle: number): Promise; + $provideWorkspaceComments(handle: number): Promise; } export interface ExtHostStorageShape { diff --git a/src/vs/workbench/api/node/extHostTypeConverters.ts b/src/vs/workbench/api/node/extHostTypeConverters.ts index 793094e713f..ebc2cf411c9 100644 --- a/src/vs/workbench/api/node/extHostTypeConverters.ts +++ b/src/vs/workbench/api/node/extHostTypeConverters.ts @@ -960,7 +960,10 @@ export namespace TextEditorOptions { export namespace GlobPattern { - export function from(pattern: vscode.GlobPattern): string | types.RelativePattern { + export function from(pattern: vscode.GlobPattern): string | types.RelativePattern; + export function from(pattern: undefined | null): undefined | null; + export function from(pattern: vscode.GlobPattern | undefined | null): string | types.RelativePattern | undefined | null; + export function from(pattern: vscode.GlobPattern | undefined | null): string | types.RelativePattern | undefined | null { if (pattern instanceof types.RelativePattern) { return pattern; } diff --git a/src/vs/workbench/api/node/extHostWorkspace.ts b/src/vs/workbench/api/node/extHostWorkspace.ts index ad7f3b3097a..b11c7f6f2ae 100644 --- a/src/vs/workbench/api/node/extHostWorkspace.ts +++ b/src/vs/workbench/api/node/extHostWorkspace.ts @@ -389,7 +389,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac // --- search --- - findFiles(include: string | RelativePattern, exclude: vscode.GlobPattern, maxResults: number, extensionId: ExtensionIdentifier, token: vscode.CancellationToken = CancellationToken.None): Promise { + findFiles(include: string | RelativePattern | undefined | null, exclude: vscode.GlobPattern | undefined | null, maxResults: number | undefined, extensionId: ExtensionIdentifier, token: vscode.CancellationToken = CancellationToken.None): Promise { this._logService.trace(`extHostWorkspace#findFiles: fileSearch, extension: ${extensionId.value}, entryPoint: findFiles`); let includePattern: string | undefined; diff --git a/src/vs/workbench/contrib/preferences/electron-browser/preferences.contribution.ts b/src/vs/workbench/contrib/preferences/electron-browser/preferences.contribution.ts index 889bee0253d..5e3c4a3ff08 100644 --- a/src/vs/workbench/contrib/preferences/electron-browser/preferences.contribution.ts +++ b/src/vs/workbench/contrib/preferences/electron-browser/preferences.contribution.ts @@ -88,7 +88,7 @@ interface ISerializedPreferencesEditorInput { // Register Preferences Editor Input Factory class PreferencesEditorInputFactory implements IEditorInputFactory { - serialize(editorInput: EditorInput): string { + serialize(editorInput: EditorInput): string | null { const input = editorInput; if (input.details && input.master) { @@ -116,7 +116,7 @@ class PreferencesEditorInputFactory implements IEditorInputFactory { return null; } - deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput { + deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput | null { const deserialized: ISerializedPreferencesEditorInput = JSON.parse(serializedEditorInput); const registry = Registry.as(EditorInputExtensions.EditorInputFactories); @@ -555,7 +555,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, { abstract class SettingsCommand extends Command { - protected getPreferencesEditor(accessor: ServicesAccessor): PreferencesEditor | SettingsEditor2 { + protected getPreferencesEditor(accessor: ServicesAccessor): PreferencesEditor | SettingsEditor2 | null { const activeControl = accessor.get(IEditorService).activeControl; if (activeControl instanceof PreferencesEditor || activeControl instanceof SettingsEditor2) { return activeControl; @@ -603,7 +603,7 @@ class FocusSettingsFileEditorCommand extends SettingsCommand { const preferencesEditor = this.getPreferencesEditor(accessor); if (preferencesEditor instanceof PreferencesEditor) { preferencesEditor.focusSettingsFileEditor(); - } else { + } else if (preferencesEditor) { preferencesEditor.focusSettings(); } }