import * as path from "path" ; import * as vscode from "vscode" ; export let doc ; export let editor ; export let documentEol ; export let platformEol ; export const extensionId = "powerquery.vscode-powerquery" ; /**
 * Activates the vscode-powerquery extension
 */ export async function activate ( docUri ) { const ext = vscode . extensions . getExtension ( extensionId ) ; if ( ! ext ) { throw new Error ( "Failed to load extension." ) ; } await ext . activate ( ) ; try { doc = await vscode . workspace . openTextDocument ( docUri ) ; editor = await vscode . window . showTextDocument ( doc ) ; } catch ( e ) { console . error ( e ) ; } } export const getDocPath = ( p ) : string => path . resolve ( __dirname , "../../../src/test/testFixture" , p ) ; export const getDocUri = ( p ) : vscode . Uri => 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 ) ) ; } export enum Commands { CompletionItems = "vscode.executeCompletionItemProvider" , DocumentSymbols = "vscode.executeDocumentSymbolProvider" , Format = "vscode.executeFormatDocumentProvider" , Hover = "vscode.executeHoverProvider" , SignatureHelp = "vscode.executeSignatureHelpProvider " }