@@ -75,6 +75,7 @@ import type { App } from "../common/app";
7575import type { Disposable } from "../common/disposable-object" ;
7676import type { RawResultSet } from "../common/raw-result-types" ;
7777import type { BqrsResultSetSchema } from "../common/bqrs-cli-types" ;
78+ import { CachedOperation } from "../language-support/contextual/cached-operation" ;
7879
7980/**
8081 * results-view.ts
@@ -177,6 +178,8 @@ export class ResultsView extends AbstractWebview<
177178 // Event listeners that should be disposed of when the view is disposed.
178179 private disposableEventListeners : Disposable [ ] = [ ] ;
179180
181+ private schemaCache : CachedOperation < [ ] , BqrsResultSetSchema [ ] > ;
182+
180183 constructor (
181184 app : App ,
182185 private databaseManager : DatabaseManager ,
@@ -206,6 +209,10 @@ export class ResultsView extends AbstractWebview<
206209 }
207210 } ) ,
208211 ) ;
212+
213+ this . schemaCache = new CachedOperation (
214+ this . getResultSetSchemasImpl . bind ( this ) ,
215+ ) ;
209216 }
210217
211218 public getCommands ( ) : ResultsViewCommands {
@@ -420,6 +427,7 @@ export class ResultsView extends AbstractWebview<
420427 ) ;
421428 return ;
422429 }
430+ this . schemaCache . reset ( ) ;
423431 // Notify the webview that it should expect new results.
424432 await this . postMessage ( { t : "resultsUpdating" } ) ;
425433 await this . _displayedQuery . completedQuery . updateSortState (
@@ -610,6 +618,12 @@ export class ResultsView extends AbstractWebview<
610618 selectedTable = "" ,
611619 ) : Promise < BqrsResultSetSchema [ ] > {
612620 const resultsPath = completedQuery . getResultsPath ( selectedTable ) ;
621+ return this . schemaCache . get ( resultsPath ) ;
622+ }
623+
624+ private async getResultSetSchemasImpl (
625+ resultsPath : string ,
626+ ) : Promise < BqrsResultSetSchema [ ] > {
613627 const schemas = await this . cliServer . bqrsInfo (
614628 resultsPath ,
615629 PAGE_SIZE . getValue ( ) ,
0 commit comments