import { Connection , RequestType } from 'vscode-languageserver' ; import { createConnection , BrowserMessageReader , BrowserMessageWriter } from 'vscode-languageserver/browser' ; import { schemaRequestHandler , workspaceContext } from '../languageservice/services/schemaRequestHandler' ; import { YAMLServerInit } from '../yamlServerInit' ; import { SettingsState } from '../yamlSettings' ; namespace FSReadFile { export const type = new RequestType ( 'fs/readFile' ) ; } const messageReader = new BrowserMessageReader ( globalThis ) ; const messageWriter = new BrowserMessageWriter ( globalThis ) ; const connection = createConnection ( messageReader , messageWriter ) ; const yamlSettings = new SettingsState ( ) ; const fileSystem = { readFile : ( fsPath ) => { return connection . sendRequest ( FSReadFile . type , fsPath ) ; } , } ; param uri const schemaRequestHandlerWrapper = ( connection , uri ) : Promise < string > => { return schemaRequestHandler ( connection , uri , yamlSettings . workspaceFolders , yamlSettings . workspaceRoot , yamlSettings . useVSCodeContentRequest , fileSystem ) ; } ; const schemaRequestService = schemaRequestHandlerWrapper . bind ( this , connection ) ; new YAMLServerInit ( connection , yamlSettings , workspaceContext , schemaRequestService ) . start ( ) ;