import * as url from 'url' ; import { DocumentContext } from '../../cssLanguageTypes' ; import { startsWith } from '../../utils/strings' ; import { joinPath } from '../../utils/resources' ; export function getDocumentContext ( workspaceFolder ? ) { return { resolveReference : ( ref , base ) => { if ( startsWith ( ref , '/' ) && workspaceFolder ) { return joinPath ( workspaceFolder , ref ) ; } try { return url . resolve ( base , ref ) ; } catch ( e ) { return undefined ; } } } ; }