@@ -17,6 +17,24 @@ import {
1717} from "@/features/extensions/types" ;
1818import { createContext , createElement , useContext , useRef , useSyncExternalStore , type ReactNode } from "react" ;
1919
20+ const BUILTIN_EXTENSION_DIR_PATH = "__dotdir_builtin__" ;
21+
22+ const BUILTIN_FILE_VIEWER : ExtensionViewerContribution = {
23+ id : "file-viewer" ,
24+ label : "File Viewer" ,
25+ patterns : [ "*" ] ,
26+ entry : "builtins/file-viewer" ,
27+ priority : - 10_000 ,
28+ } ;
29+
30+ const BUILTIN_MONACO_EDITOR : ExtensionEditorContribution = {
31+ id : "monaco" ,
32+ label : "Monaco Editor" ,
33+ patterns : [ "*" ] ,
34+ entry : "builtins/monaco" ,
35+ priority : - 10_000 ,
36+ } ;
37+
2038export interface ResolvedViewer {
2139 contribution : ExtensionViewerContribution ;
2240 extensionDirPath : string ;
@@ -152,6 +170,10 @@ export class ViewerEditorRegistryManager {
152170 private version = 0 ;
153171 private listeners = new Set < RegistryListener > ( ) ;
154172
173+ constructor ( ) {
174+ this . registerBuiltIns ( ) ;
175+ }
176+
155177 subscribe ( listener : RegistryListener ) : ( ) => void {
156178 this . listeners . add ( listener ) ;
157179 return ( ) => {
@@ -163,10 +185,16 @@ export class ViewerEditorRegistryManager {
163185 return this . version ;
164186 }
165187
188+ private registerBuiltIns ( ) : void {
189+ this . viewerRegistry . register ( BUILTIN_FILE_VIEWER , BUILTIN_EXTENSION_DIR_PATH ) ;
190+ this . editorRegistry . register ( BUILTIN_MONACO_EDITOR , BUILTIN_EXTENSION_DIR_PATH ) ;
191+ }
192+
166193 replaceExtensions ( extensions : LoadedExtension [ ] ) : void {
167194 this . viewerRegistry . clear ( ) ;
168195 this . editorRegistry . clear ( ) ;
169196 this . fsProviderRegistry . clear ( ) ;
197+ this . registerBuiltIns ( ) ;
170198
171199 for ( const ext of extensions ) {
172200 for ( const viewer of extensionViewers ( ext ) ) {
0 commit comments