import { ExtensionContext , Uri } from 'vscode' ; import { LanguageClientOptions } from 'vscode-languageclient' ; import { LanguageClient } from 'vscode-languageclient/browser' ; export function activate ( context ) { console . log ( 'lsp-web-extension-sample activated!' ) ; const documentSelector = [ { language : 'plaintext' } ] ; const clientOptions = { documentSelector , synchronize : { } , initializationOptions : { } } ; const client = createWorkerLanguageClient ( context , clientOptions ) ; const disposable = client . start ( ) ; context . subscriptions . push ( disposable ) ; client . onReady ( ) . then ( ( ) => { console . log ( 'lsp-web-extension-sample server is ready' ) ; } ) ; } function createWorkerLanguageClient ( context , clientOptions ) { const serverMain = Uri . joinPath ( context . extensionUri , 'server/dist/browserServerMain.js' ) ; const worker = new Worker ( serverMain . toString ( ) ) ; return new LanguageClient ( 'lsp-web-extension-sample' , 'LSP Web Extension Sample' , clientOptions , worker ) ; }