diff --git a/src/parser.ts b/src/parser.ts index 5e47c86..bf38d5f 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -12,7 +12,7 @@ export class Parser { const result: NamedCodeBlock[] = []; const file = view.file; - const fileContent = await view.app.vault.read(file); + const fileContent = await view.app.vault.cachedRead(file); const fileCache = view.app.metadataCache.getFileCache( file ); if ( fileCache == null ){ @@ -210,7 +210,7 @@ export class Parser { } = {}; const file = view.file; - const fileContent = await view.app.vault.read(file); + const fileContent = await view.app.vault.cachedRead(file); const fileCache = view.app.metadataCache.getFileCache( file ); if ( fileCache == null ){ @@ -232,9 +232,6 @@ export class Parser { } if ( section.type == 'table' ){ - // const from = editor.offsetToPos(section.position.start.offset); - // const to = editor.offsetToPos(section.position.end.offset); - // const table = editor.getRange( from, to ); const table = fileContent.slice( section.position.start.offset, section.position.end.offset diff --git a/src/rci-io.ts b/src/rci-io.ts index 7904c60..02f5b73 100644 --- a/src/rci-io.ts +++ b/src/rci-io.ts @@ -45,8 +45,8 @@ export class IoRunContextImplementation implements TIoRunContext { if (file instanceof TFile){ if ( file.extension == 'csv'){ - const csvdata = await this.vault.read( file ); - const dataSet = pzr.loadCsv(csvdata); + const csvData = await this.vault.cachedRead( file ); + const dataSet = pzr.loadCsv(csvData); this.data[name??file.basename] = dataSet; return dataSet; } @@ -70,7 +70,7 @@ export class IoRunContextImplementation implements TIoRunContext { } if ( file.extension == 'md' ){ - const content = await this.vault.read( file ); + const content = await this.vault.cachedRead( file ); const pzr = new Parser(); pzr.applyMarkdownContent( file.basename, @@ -94,7 +94,7 @@ export class IoRunContextImplementation implements TIoRunContext { return undefined; } - return await this.vault.read(af) + return await this.vault.cachedRead(af) } async load_data(path: string, name?: string | undefined): Promise { diff --git a/src/rci-markers.ts b/src/rci-markers.ts index 60a601e..45e6f99 100644 --- a/src/rci-markers.ts +++ b/src/rci-markers.ts @@ -71,7 +71,7 @@ export class MarkerRunContextImplementation implements TMarkerRunContext { private async getTargetContents() : Promise{ const targetFile = this.getTargetFileOrThrow(); - return await this.vault.read( targetFile ); + return await this.vault.cachedRead( targetFile ); } async fetch(): Promise {