diff --git a/src/index.ts b/src/index.ts index c7659ec..0737e5b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,7 @@ import { createEditor, createModelReference, registerEditorOpenHandler } from '. import { updateUserConfiguration, registerConfigurations, registerDefaultConfigurations, onConfigurationChanged, getConfiguration, getUserConfiguration, onUserConfigurationChange } from './configuration' import { getMonacoLanguage, loadLanguage } from './languages' import { updateKeybindings, updateEditorKeybindingsMode } from './keybindings' -import { generateAndInitializeWorkspace, initialize, initializePromise, isInitialized, registerServices, setUseGlobalPicker } from './services' +import { generateAndInitializeWorkspace, initialize, initializePromise, isInitialized, registerFile, registerServices, setUseGlobalPicker } from './services' import './style' export * from './tools' @@ -16,6 +16,7 @@ export { initializePromise, createEditor, createModelReference, + registerFile, registerConfigurations, registerDefaultConfigurations, diff --git a/src/services.ts b/src/services.ts index e908510..a54fc1c 100644 --- a/src/services.ts +++ b/src/services.ts @@ -19,12 +19,19 @@ import getWorkingCopyServiceOverride from '@codingame/monaco-vscode-working-copy import getEmmetServiceOverride from '@codingame/monaco-vscode-emmet-service-override' import { initialize as initializeServices } from 'vscode/services' import * as monaco from 'monaco-editor' -import { initFile } from '@codingame/monaco-vscode-files-service-override' +import { RegisteredFile, RegisteredFileSystemProvider, initFile, registerFileSystemOverlay } from '@codingame/monaco-vscode-files-service-override' import { IWorkbenchConstructionOptions, IWorkspaceProvider } from 'vscode/vscode/vs/workbench/browser/web.api' import EditorOpenHandlerRegistry from './tools/EditorOpenHandlerRegistry' import { whenReady as whenExtensionsReady } from './extensions' import 'vscode/localExtensionHost' +const defaultFilesystemProvider = new RegisteredFileSystemProvider(false) +registerFileSystemOverlay(1, defaultFilesystemProvider) + +export function registerFile (file: RegisteredFile): monaco.IDisposable { + return defaultFilesystemProvider.registerFile(file) +} + const editorOpenHandlerRegistry = new EditorOpenHandlerRegistry() let _useGlobalPicker: boolean = false