Skip to content

Commit

Permalink
feat: add registerFile function
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Mangeonjean committed Apr 15, 2024
1 parent ada7dfe commit d1cad30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -16,6 +16,7 @@ export {
initializePromise,
createEditor,
createModelReference,
registerFile,

registerConfigurations,
registerDefaultConfigurations,
Expand Down
9 changes: 8 additions & 1 deletion src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d1cad30

Please sign in to comment.