-
Notifications
You must be signed in to change notification settings - Fork 28.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce unused exports #164938
Comments
Let's pause a moment and re-consider all the |
So, suggestion 1 is to rerun with the |
I also have expressed some concerns in #164934 (comment) |
Quick clarification here: the primary purpose of this issue is to identify unused functions and classes which aren't being picked up by the compiler because they're exported and which can be safely deleted from our sources to reduce our bundle size. A secondary benefit is to remove unused types and interfaces, e.g. anything which was exported at one point and then ceased to be referenced from other files (which more impacts compile time for dev workflows and pipeline runs, and maybe TS server analysis time, but has no direct impact on bundle size since types are erased). If you export a type or interface that is not currently actively imported, but is used in the public API of a class that you expose, then it's quite likely that you want to keep that type/interface exported and should not un-export it as part of this issue. As @jrieken pointed out there are several such false positives from this tool. From talking to @rebornix we can achieve at least the primary purpose of this issue a different way, e.g. by adapting the existing tree shaking tooling we have for Monaco to flag dead code in |
@joyceerhl, are we still pursuing this effort? |
Closing this without further action |
@rebornix and I were wondering if there is any dead code in the VS Code codebase, and one idea was to detect unused exports across the codebase, since unused variables are flagged by the compiler but unused exports are not.
I ran
ts-unused-exports
on our sources and generated the following list. I've already done a pass to remove some false positives but apologies if several remain.NB: The primary purpose of this issue is to identify unused functions and classes which aren't being picked up by the compiler because they're exported and which can be safely deleted from our sources to reduce our bundle size. A secondary benefit is to remove unused types and interfaces, e.g. anything which was exported at one point and then ceased to be referenced from other files (which more impacts compile time for dev workflows and pipeline runs, and maybe TS server analysis time, but has no direct impact on bundle size since types are erased).
If you export a type or interface that is not currently actively imported, but is used in the public API of a class that you expose, then it's quite likely that you want to keep that type/interface exported and need not un-export it as part of this issue.
Please feel free to remove your assignment if you find that this isn't valuable.
SelectKernelReturnArgs
IBreadcrumbsWidgetStyles
InvisibleSizing
IResizeEvent
SplitSizing
InvisibleSizing
Revived
mapPager
ValueCallback
ICommandMenuOptions
IEditorActionContextMenuOptions
_CSS_MAP
IGetWordAtTextConfig
CodeLensCache
IDecorationIdCallback
MarkerCoordinate
ctxHasSymbols
ctxReferenceSearchVisible
SelectionEvent
RenameInputFieldResult
Token
TransformableMarker
OneSnippet
ISnippetSessionInsertOptions
IReadClipboardText
ICompletionStats
MemItem
MemMode
SuggestMemoryService
SuggestContentWidget
ISuggestionTemplateData
ViewZoneDelegate
OverlayWidgetDelegate
createDiffNavigator
getModelMarkers
getModel
onDidChangeModelLanguage
register
onLanguage
setLanguageConfiguration
IColors
ILoadStatus
ICommandActionToggleInfo
IDropdownWithDefaultActionViewItemOptions
DropdownWithDefaultActionViewItem
IWorkbenchToolBarOptions
IToolBarRenderOptions
IMenuWorkbenchToolBarOptions
IMenuRegistryChangeEvent
IMenuRegistry
ICommand
ICommandRegistry
AbstractContextKeyService
Node
IV8CallFrame
IComputedNode
ISourceLocation
CdpPositionTickInfo
INode
ILocation
IAnnotationLocation
IProfileNode
ICpuProfileRaw
SampleData
create
IScriptUrlClassifier
CategoryAnalysis
IBreadcrumbsWidgetStyleOverrides
defaultBreadcrumbsStyles
Idle
CheckingForUpdates
Downloading
Downloaded
Updating
Ready
ExtHostDebugConsole
IExtHostDocumentsAndEditorsDelta
Tunnel
IConsolePatchFn
MarketplaceExtension
BreadcrumbsService
SelectEvent
FileSorter
CheckedStates
ICheckable
DocumentSymbolItem
INotebookRawData
createTestNotebookEditor
SearchEditorData
extractSearchQueryFromModel
extractSearchQueryFromLines
ISimpleModel
validateTerminalName
allWalkthroughsHiddenContext
IExtensionDevOptions
ILanguageStatusProvider
IMemoryInfo
Filters
AssignmentService
IWalkthroughStep
IStartEntry
IPropertyData
StrictPropertyChecker
StrictPropertyCheckError
Properties
Measurements
ExtHostTelemetryLogger
EditorReplacement
IResourceMergeEditorInputSide
IMatchOptions
TimelineExcludeSources
embedderIdentifierContext
IWelcomePageStartEntry
HasMultipleNewFileEntries
walkthroughMetadataConfigurationKey
WalkthroughMetaDataType
IWalkthrough
IWalkthroughLoose
IWalkthroughStep
WalkthroughsService
BuiltinGettingStartedStep
BuiltinGettingStartedCategory
BuiltinGettingStartedStartEntry
OtherTestEditor
WorkspaceTrustRequestButton
ExtHostSCMInputBox
IExtHostTimeline
maxSize
SCMActionButton
TimelineFollowActiveEditorContext
TimelineElementTemplate
TimelineIdentityProvider
TimelineKeyboardNavigationLabelProvider
TimelineListVirtualDelegate
toKey
TimelineSource
WorkspaceTrustRequestService
The text was updated successfully, but these errors were encountered: