Skip to content

Commit 73dfcaa

Browse files
authored
Improve cache population (#267)
* Cache on inline completion request * UI polish * Don't populate cache if file is too big
1 parent a10c8be commit 73dfcaa

File tree

3 files changed

+164
-261
lines changed

3 files changed

+164
-261
lines changed

src/extension/typescriptContext/vscode-node/inspector.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,9 @@ class TreeContextRequest {
390390
this.position = event.position;
391391
this.items = event.results;
392392
this.summary = event.summary;
393-
const now = new Date();
394-
const timeString = `${now.getMinutes().toString().padStart(2, '0')}:${now.getSeconds().toString().padStart(2, '0')}.${now.getMilliseconds().toString().padStart(3, '0')}`;
395-
this.label = `${label} - ${timeString} - [${this.position.line + 1}:${this.position.character + 1}]`;
393+
const start = new Date(Date.now() - this.summary.totalTime);
394+
const timeString = `${start.getMinutes().toString().padStart(2, '0')}:${start.getSeconds().toString().padStart(2, '0')}.${start.getMilliseconds().toString().padStart(3, '0')}`;
395+
this.label = `[${timeString}] - [${this.position.line + 1}:${this.position.character + 1}] ${label} - ${this.summary.stats.yielded} items`;
396396
if (this.summary.serverComputed && this.summary.serverComputed.size > 0) {
397397
this.label += ` - ⏳ ${this.summary.totalTime}ms`;
398398
} else {
@@ -456,13 +456,13 @@ export class InspectorDataProvider implements vscode.TreeDataProvider<InspectorI
456456
this.onDidChangeTreeData = this._onDidChangeTreeData.event;
457457
this.items = [];
458458
this.languageContextService.onCachePopulated((event) => {
459-
this.addContextRequest(new TreeContextRequest(`Cache Population Request`, event));
459+
this.addContextRequest(new TreeContextRequest(`Cache`, event));
460460
});
461461
this.languageContextService.onContextComputed((event) => {
462-
this.addContextRequest(new TreeContextRequest(`Context Compute Request`, event));
462+
this.addContextRequest(new TreeContextRequest(`Context`, event));
463463
});
464464
this.languageContextService.onContextComputedOnTimeout((event) => {
465-
this.addContextRequest(new TreeContextRequest(`Context On Timeout Request`, event));
465+
this.addContextRequest(new TreeContextRequest(`OnTimeout`, event));
466466
});
467467
}
468468

0 commit comments

Comments
 (0)