Tiny rearrangment and added some logging to begin with

This commit is contained in:
Noah Santschi-Cooney 2018-08-04 01:46:20 +01:00
parent 9a3a6f54cc
commit 9660263dad
No known key found for this signature in database
GPG key ID: 3B22282472C8AE48
7 changed files with 132 additions and 38 deletions

View file

@ -1,5 +1,6 @@
import { connection, documents } from './server'
import { readFileSync } from 'fs'
import { conf } from './config'
export function postError(e: Error) {
connection.window.showErrorMessage(e.message)
@ -11,4 +12,8 @@ export const formatURI = (uri: string) => uri.replace(/^file:\/\//, '').replace(
export function getDocumentContents(uri: string): string {
if (documents.keys().includes('file://' + uri)) return documents.get('file://' + uri).getText()
else return readFileSync(uri).toString()
}
export function trimPath(path: string): string {
return path.replace(conf.shaderpacksPath, '')
}