import * as vscode from 'vscode' ; import * as path from 'path' ; export let doc ; export let editor ; export let documentEol ; export let platformEol ; /**
 * Activates the vscode.lsp-sample extension
 */ export async function activate ( docUri ) { const ext = vscode . extensions . getExtension ( 'vscode-samples.lsp-sample' ) ! ; await ext . activate ( ) ; try { doc = await vscode . workspace . openTextDocument ( docUri ) ; editor = await vscode . window . showTextDocument ( doc ) ; await sleep ( 2000 ) ; } catch ( e ) { console . error ( e ) ; } } async function sleep ( ms ) { return new Promise ( resolve => setTimeout ( resolve , ms ) ) ; } export const getDocPath = ( p ) => { return path . resolve ( __dirname , '../../testFixture' , p ) ; } ; export const getDocUri = ( p ) => { return vscode . Uri . file ( getDocPath ( p ) ) ; } ; export async function setTestContent ( content ) { const all = new vscode . Range ( doc . positionAt ( 0 ) , doc . positionAt ( doc . getText ( ) . length ) ) ; return editor . edit ( eb => eb . replace ( all , content ) ) ; }