Skip to content

Add developer logs limit setting#455

Merged
Codeneos merged 2 commits into
mainfrom
feature/dev-log-limit
May 27, 2026
Merged

Add developer logs limit setting#455
Codeneos merged 2 commits into
mainfrom
feature/dev-log-limit

Conversation

@Codeneos
Copy link
Copy Markdown
Owner

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

Copilot AI review requested due to automatic review settings May 27, 2026 08:02
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.developerLogsLimit setting (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.

Comment on lines +211 to +213
// 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);
@sonarqubecloud
Copy link
Copy Markdown

@Codeneos Codeneos merged commit 52045cd into main May 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants