From d3aa0bc3cc5a5da3cfc29d42ba5c33814c1112e2 Mon Sep 17 00:00:00 2001 From: Mathew Pareles Date: Mon, 17 Feb 2025 17:56:20 -0800 Subject: [PATCH] fix readfile --- .../contrib/void/browser/helpers/readFile.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/helpers/readFile.ts b/src/vs/workbench/contrib/void/browser/helpers/readFile.ts index f7752b84..7c03f036 100644 --- a/src/vs/workbench/contrib/void/browser/helpers/readFile.ts +++ b/src/vs/workbench/contrib/void/browser/helpers/readFile.ts @@ -20,7 +20,7 @@ export const VSReadFile = async (modelService: IModelService, fileService: IFile // read files from VSCode. preferred (but appears to only work if the model of this URI already exists. If it doesn't use the other function.) export const _VSReadModel = async (modelService: IModelService, uri: URI): Promise => { - // attempt to read saved model (sometimes doesn't work if page is reloaded) + // attempt to read saved model (doesn't work if application was reloaded...) const model = modelService.getModel(uri) if (model) { return model.getValue(EndOfLinePreference.LF) @@ -38,7 +38,12 @@ export const _VSReadModel = async (modelService: IModelService, uri: URI): Promi } export const _VSReadFileRaw = async (fileService: IFileService, uri: URI) => { - const res = await fileService.readFile(uri) - const str = res.value.toString() - return str + try { + const res = await fileService.readFile(uri) + const str = res.value.toString() + return str + } catch (e) { + return '' + } + }