import * as vscode from "vscode" ; import * as path from "path" ; export function getGlobalOptions ( document ) { const lessFilenamePath = path . parse ( document . fileName ) ; const defaultOptions = { plugins : [ ] , rootFileInfo : getRootFileInfo ( lessFilenamePath ) , relativeUrls : false , } ; const configuredOptions = vscode . workspace . getConfiguration ( "less" , document . uri ) . get < EasyLessOptions > ( "compile" ) ; return { ... defaultOptions , ... configuredOptions } ; } export function getRootFileInfo ( parsedPath ) { parsedPath . ext = ".less" ; parsedPath . base = parsedPath . name + ".less" ; return { filename : parsedPath . base , currentDirectory : parsedPath . dir , relativeUrls : false , entryPath : parsedPath . dir + "/" , rootpath : null ! , rootFilename : null ! , reference : undefined ! , } ; } export interface EasyLessOptions extends Less . Options { main ? : string | string [ ] ; out ? : string | boolean ; outExt ? : string ; sourceMap ? : any ; relativeUrls ? : boolean ; sourceMapFileInline ? : boolean ; autoprefixer ? : string | string [ ] ; javascriptEnabled ? : boolean ; rootFileInfo ? : Less . RootFileInfo ; }