From 0a9c584a084dced75aec11e1e2ec7c45a037cd52 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Fri, 24 Mar 2023 01:03:34 -0400 Subject: [PATCH] Code-splits the file annotations --- src/annotations/fileAnnotationController.ts | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/annotations/fileAnnotationController.ts b/src/annotations/fileAnnotationController.ts index d096129..466332d 100644 --- a/src/annotations/fileAnnotationController.ts +++ b/src/annotations/fileAnnotationController.ts @@ -39,10 +39,7 @@ import type { } from '../trackers/gitDocumentTracker'; import type { AnnotationContext, AnnotationProviderBase, TextEditorCorrelationKey } from './annotationProvider'; import { AnnotationStatus, getEditorCorrelationKey } from './annotationProvider'; -import { GutterBlameAnnotationProvider } from './gutterBlameAnnotationProvider'; import type { ChangesAnnotationContext } from './gutterChangesAnnotationProvider'; -import { GutterChangesAnnotationProvider } from './gutterChangesAnnotationProvider'; -import { GutterHeatmapBlameAnnotationProvider } from './gutterHeatmapBlameAnnotationProvider'; export const enum AnnotationClearReason { User = 'User', @@ -467,17 +464,27 @@ export class FileAnnotationController implements Disposable { let provider: AnnotationProviderBase | undefined = undefined; switch (type) { - case FileAnnotationType.Blame: + case FileAnnotationType.Blame: { + const { GutterBlameAnnotationProvider } = await import( + /* webpackChunkName: "annotations-blame" */ './gutterBlameAnnotationProvider' + ); provider = new GutterBlameAnnotationProvider(editor, trackedDocument, this.container); break; - - case FileAnnotationType.Changes: + } + case FileAnnotationType.Changes: { + const { GutterChangesAnnotationProvider } = await import( + /* webpackChunkName: "annotations-changes" */ './gutterChangesAnnotationProvider' + ); provider = new GutterChangesAnnotationProvider(editor, trackedDocument, this.container); break; - - case FileAnnotationType.Heatmap: + } + case FileAnnotationType.Heatmap: { + const { GutterHeatmapBlameAnnotationProvider } = await import( + /* webpackChunkName: "annotations-heatmap" */ './gutterHeatmapBlameAnnotationProvider' + ); provider = new GutterHeatmapBlameAnnotationProvider(editor, trackedDocument, this.container); break; + } } if (provider == null || !(await provider.validate())) return undefined;