import fs = require ( 'fs' ) ; import os = require ( 'os' ) ; import path = require ( 'path' ) ; import * as vscode from 'vscode' ; export let PowerShellLanguageId = 'advpl' ; export function ensurePathExists ( targetPath ) { try { fs . mkdirSync ( targetPath ) ; } catch ( e ) { if ( e . code != 'EEXIST' ) { throw e ; } } } export interface EditorServicesSessionDetails { channel : string ; languageServicePort : number ; debugServicePort : number ; } export function checkIfFileExists ( filePath ) { try { fs . accessSync ( filePath , fs . constants . R_OK ) ; return true ; } catch ( e ) { return false ; } } export function getConfigurationAsString ( ) { return JSON . stringify ( vscode . workspace . getConfiguration ( "advpl" ) ) ; } export function hasCompileKey ( ) { const config = vscode . workspace . getConfiguration ( 'advpl' ) ; return config . get < string > ( 'compileToken' , '' ) . trim ( ) !== '' || config . get < string > ( 'authorization_code' , '' ) . trim ( ) !== '' ; }