提交 82e9561f 编写于 作者: M Matt Bierner

Strict null checks

上级 acbcd7e1
...@@ -256,6 +256,7 @@ ...@@ -256,6 +256,7 @@
"./vs/editor/contrib/wordPartOperations/test/wordPartOperations.test.ts", "./vs/editor/contrib/wordPartOperations/test/wordPartOperations.test.ts",
"./vs/editor/contrib/wordPartOperations/wordPartOperations.ts", "./vs/editor/contrib/wordPartOperations/wordPartOperations.ts",
"./vs/editor/contrib/zoneWidget/zoneWidget.ts", "./vs/editor/contrib/zoneWidget/zoneWidget.ts",
"./vs/editor/editor.api.ts",
"./vs/editor/editor.worker.ts", "./vs/editor/editor.worker.ts",
"./vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts", "./vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts",
"./vs/editor/standalone/browser/colorizer.ts", "./vs/editor/standalone/browser/colorizer.ts",
...@@ -264,6 +265,8 @@ ...@@ -264,6 +265,8 @@
"./vs/editor/standalone/browser/simpleServices.ts", "./vs/editor/standalone/browser/simpleServices.ts",
"./vs/editor/standalone/browser/standaloneCodeEditor.ts", "./vs/editor/standalone/browser/standaloneCodeEditor.ts",
"./vs/editor/standalone/browser/standaloneCodeServiceImpl.ts", "./vs/editor/standalone/browser/standaloneCodeServiceImpl.ts",
"./vs/editor/standalone/browser/standaloneEditor.ts",
"./vs/editor/standalone/browser/standaloneLanguages.ts",
"./vs/editor/standalone/browser/standaloneServices.ts", "./vs/editor/standalone/browser/standaloneServices.ts",
"./vs/editor/standalone/browser/standaloneThemeServiceImpl.ts", "./vs/editor/standalone/browser/standaloneThemeServiceImpl.ts",
"./vs/editor/standalone/browser/toggleHighContrast/toggleHighContrast.ts", "./vs/editor/standalone/browser/toggleHighContrast/toggleHighContrast.ts",
...@@ -274,6 +277,7 @@ ...@@ -274,6 +277,7 @@
"./vs/editor/standalone/common/standaloneThemeService.ts", "./vs/editor/standalone/common/standaloneThemeService.ts",
"./vs/editor/standalone/common/themes.ts", "./vs/editor/standalone/common/themes.ts",
"./vs/editor/standalone/test/browser/simpleServices.test.ts", "./vs/editor/standalone/test/browser/simpleServices.test.ts",
"./vs/editor/standalone/test/browser/standaloneLanguages.test.ts",
"./vs/editor/test/browser/controller/imeTester.ts", "./vs/editor/test/browser/controller/imeTester.ts",
"./vs/editor/test/browser/editorTestServices.ts", "./vs/editor/test/browser/editorTestServices.ts",
"./vs/editor/test/browser/testCodeEditor.ts", "./vs/editor/test/browser/testCodeEditor.ts",
...@@ -508,6 +512,7 @@ ...@@ -508,6 +512,7 @@
"./vs/platform/workspaces/node/workspacesIpc.ts", "./vs/platform/workspaces/node/workspacesIpc.ts",
"./vs/vscode.d.ts", "./vs/vscode.d.ts",
"./vs/vscode.proposed.d.ts", "./vs/vscode.proposed.d.ts",
"./vs/workbench/api/browser/viewsContainersExtensionPoint.ts",
"./vs/workbench/api/node/extHostExtensionActivator.ts", "./vs/workbench/api/node/extHostExtensionActivator.ts",
"./vs/workbench/api/node/extHostSearch.fileIndex.ts", "./vs/workbench/api/node/extHostSearch.fileIndex.ts",
"./vs/workbench/api/node/extHostTypes.ts", "./vs/workbench/api/node/extHostTypes.ts",
...@@ -539,7 +544,10 @@ ...@@ -539,7 +544,10 @@
"./vs/workbench/browser/parts/editor/resourceViewer.ts", "./vs/workbench/browser/parts/editor/resourceViewer.ts",
"./vs/workbench/browser/parts/editor/sideBySideEditor.ts", "./vs/workbench/browser/parts/editor/sideBySideEditor.ts",
"./vs/workbench/browser/parts/editor/textEditor.ts", "./vs/workbench/browser/parts/editor/textEditor.ts",
"./vs/workbench/browser/parts/notifications/notificationsActions.ts",
"./vs/workbench/browser/parts/notifications/notificationsAlerts.ts", "./vs/workbench/browser/parts/notifications/notificationsAlerts.ts",
"./vs/workbench/browser/parts/notifications/notificationsCommands.ts",
"./vs/workbench/browser/parts/notifications/notificationsStatus.ts",
"./vs/workbench/browser/parts/quickinput/quickInputBox.ts", "./vs/workbench/browser/parts/quickinput/quickInputBox.ts",
"./vs/workbench/browser/parts/quickinput/quickInputUtils.ts", "./vs/workbench/browser/parts/quickinput/quickInputUtils.ts",
"./vs/workbench/browser/parts/quickopen/quickopen.ts", "./vs/workbench/browser/parts/quickopen/quickopen.ts",
......
...@@ -37,6 +37,8 @@ import { IMarker, IMarkerData } from 'vs/platform/markers/common/markers'; ...@@ -37,6 +37,8 @@ import { IMarker, IMarkerData } from 'vs/platform/markers/common/markers';
import { INotificationService } from 'vs/platform/notification/common/notification'; import { INotificationService } from 'vs/platform/notification/common/notification';
import { IOpenerService } from 'vs/platform/opener/common/opener'; import { IOpenerService } from 'vs/platform/opener/common/opener';
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
function withAllStandaloneServices<T extends editorCommon.IEditor>(domElement: HTMLElement, override: IEditorOverrideServices, callback: (services: DynamicStandaloneServices) => T): T { function withAllStandaloneServices<T extends editorCommon.IEditor>(domElement: HTMLElement, override: IEditorOverrideServices, callback: (services: DynamicStandaloneServices) => T): T {
let services = new DynamicStandaloneServices(domElement, override); let services = new DynamicStandaloneServices(domElement, override);
...@@ -260,15 +262,14 @@ export function colorizeModelLine(model: ITextModel, lineNumber: number, tabSize ...@@ -260,15 +262,14 @@ export function colorizeModelLine(model: ITextModel, lineNumber: number, tabSize
/** /**
* @internal * @internal
*/ */
function getSafeTokenizationSupport(language: string): modes.ITokenizationSupport { function getSafeTokenizationSupport(language: string): Omit<modes.ITokenizationSupport, 'tokenize2'> {
let tokenizationSupport = modes.TokenizationRegistry.get(language); let tokenizationSupport = modes.TokenizationRegistry.get(language);
if (tokenizationSupport) { if (tokenizationSupport) {
return tokenizationSupport; return tokenizationSupport;
} }
return { return {
getInitialState: () => NULL_STATE, getInitialState: () => NULL_STATE,
tokenize: (line: string, state: modes.IState, deltaOffset: number) => nullTokenize(language, line, state, deltaOffset), tokenize: (line: string, state: modes.IState, deltaOffset: number) => nullTokenize(language, line, state, deltaOffset)
tokenize2: undefined,
}; };
} }
......
...@@ -345,10 +345,10 @@ export function registerSignatureHelpProvider(languageId: string, provider: mode ...@@ -345,10 +345,10 @@ export function registerSignatureHelpProvider(languageId: string, provider: mode
*/ */
export function registerHoverProvider(languageId: string, provider: modes.HoverProvider): IDisposable { export function registerHoverProvider(languageId: string, provider: modes.HoverProvider): IDisposable {
return modes.HoverProviderRegistry.register(languageId, { return modes.HoverProviderRegistry.register(languageId, {
provideHover: (model: model.ITextModel, position: Position, token: CancellationToken): Promise<modes.Hover> => { provideHover: (model: model.ITextModel, position: Position, token: CancellationToken): Promise<modes.Hover | undefined> => {
let word = model.getWordAtPosition(position); let word = model.getWordAtPosition(position);
return Promise.resolve<modes.Hover | null | undefined>(provider.provideHover(model, position, token)).then((value) => { return Promise.resolve<modes.Hover | null | undefined>(provider.provideHover(model, position, token)).then((value): modes.Hover | undefined => {
if (!value) { if (!value) {
return undefined; return undefined;
} }
......
...@@ -153,7 +153,7 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution { ...@@ -153,7 +153,7 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution {
return order; return order;
} }
private registerCustomViewlet(descriptor: IUserFriendlyViewsContainerDescriptor2, order: number, cssClass: string, extensionId: ExtensionIdentifier): void { private registerCustomViewlet(descriptor: IUserFriendlyViewsContainerDescriptor2, order: number, cssClass: string, extensionId: ExtensionIdentifier | undefined): void {
const viewContainersRegistry = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry); const viewContainersRegistry = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry);
const viewletRegistry = Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets); const viewletRegistry = Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets);
const id = descriptor.id; const id = descriptor.id;
......
...@@ -62,7 +62,7 @@ export interface INotificationsToastController { ...@@ -62,7 +62,7 @@ export interface INotificationsToastController {
export function registerNotificationCommands(center: INotificationsCenterController, toasts: INotificationsToastController): void { export function registerNotificationCommands(center: INotificationsCenterController, toasts: INotificationsToastController): void {
function getNotificationFromContext(listService: IListService, context?: any): INotificationViewItem { function getNotificationFromContext(listService: IListService, context?: any): INotificationViewItem | undefined {
if (isNotificationViewItem(context)) { if (isNotificationViewItem(context)) {
return context; return context;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册