Add developer logs limit setting#455
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2f854179f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -1,5 +1,5 @@ | |||
| import * as vscode from 'vscode'; | |||
| import VlocodeService from '../../lib/vlocodeService'; | |||
| import type VlocodeService from '../../lib/vlocodeService'; | |||
There was a problem hiding this comment.
Restore runtime import for DI metadata
Using import type here erases VlocodeService from the emitted JavaScript, so the decorator metadata for DeveloperLogDataProvider's first constructor parameter is no longer the VlocodeService class. The extension resolves this provider through the custom DI container (container.get(DeveloperLogDataProvider)), which relies on design:paramtypes; with this change it resolves the service argument as undefined, and TreeDataProvider immediately dereferences this.vlocode.commands during activation.
Useful? React with 👍 / 👎.
| // Only display the configured number of log entries | ||
| this.logs = newLogs.sort((a,b) => b.startTime.getTime() - a.startTime.getTime()); | ||
| this.logs.splice(100); | ||
| this.logs.splice(this.vlocode.config.salesforce.developerLogsLimit ?? 100); |
There was a problem hiding this comment.
Apply the limit even when no new logs arrive
If a user changes developerLogsLimit from the default to a smaller value and refreshes while Salesforce returns no new ApexLog rows, refreshLogs returns earlier when newLogs.length == this.logs.length, so this splice is never reached and the panel keeps showing the old number of logs until another log is created or the provider is reset. The limit should be applied before that early return or the setting should trigger a retrim/refresh of the cached logs.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Adds a new VS Code setting to cap the number of entries shown in the Salesforce Developer Logs tree, defaulting to 100, and validates behavior via a new unit test.
Changes:
- Add
vlocity.salesforce.developerLogsLimitsetting (default: 100) to the extension configuration contributions. - Use the configured limit when trimming developer logs in
DeveloperLogDataProvider. - Add unit tests covering default (100) and custom limits.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/vscode-extension/src/treeViews/dataProviders/developerLogDataProvider.ts | Applies the configured log limit when trimming the displayed developer logs. |
| packages/vscode-extension/src/lib/vlocodeConfiguration.ts | Extends the Salesforce configuration type with developerLogsLimit. |
| packages/vscode-extension/src/tests/developerLogDataProvider.test.ts | Adds tests for default and configured log limits. |
| packages/vscode-extension/package.json | Contributes the new vlocity.salesforce.developerLogsLimit setting with default 100. |
| // Only display the configured number of log entries | ||
| this.logs = newLogs.sort((a,b) => b.startTime.getTime() - a.startTime.getTime()); | ||
| this.logs.splice(100); | ||
| this.logs.splice(this.vlocode.config.salesforce.developerLogsLimit ?? 100); |
|



Adds a configurable Developer Logs panel limit with a default of 100.