Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 22, 2025

Implementation Complete: Add Setting to Control Inline Console Logs

Summary

Successfully implemented a new VSCode extension setting vitest.showInlineConsoleLog that allows users to control the inline display of console.log messages in the editor while debugging Vitest tests.

Changes Made

1. Configuration Setting (package.json)

  • Setting name: vitest.showInlineConsoleLog
    • Type: boolean
    • Default: true (maintains current behavior - inline logs are shown)
    • Scope: resource (per-workspace configuration)
    • Description: "Show inline console.log messages in the editor. When disabled, console logs will still appear in the test output but not inline next to the code."

2. Configuration Reader (config.ts)

  • Added showInlineConsoleLog to config reader
  • Returns setting value from workspace configuration (default: true)

3. Test Runner (runner.ts)

  • Added showInlineConsoleLog property to TestRunner class
  • Initialized with workspace-specific config on instantiation
  • Modified onConsoleLog handler to conditionally pass location:
    • When setting is true (default): location is provided → inline display
    • When setting is false: location is undefined → no inline display
  • Added configuration change listener for dynamic updates without reload

4. Documentation (README.md)

  • Added vitest.showInlineConsoleLog to the Configuration section
  • Documented the setting's purpose, behavior, and default value

5. Additional Improvements

  • Updated .gitignore to exclude *.tsbuildinfo build artifacts
  • Added scope: "resource" to existing settings (applyDiagnostic, showImportsDuration) for consistency

Technical Details

How it works:

  • Console logs are displayed inline when testRun.appendOutput() receives a location parameter
  • By conditionally setting location = undefined when the setting is disabled, inline display is suppressed
  • Console logs still appear in the test output panel regardless of setting

Features:

  • ✅ Per-workspace configuration via scope: "resource"
  • ✅ Dynamic updates - changes take effect immediately without reload
  • ✅ Multi-workspace support - uses workspace-specific config
  • ✅ Backward compatible - default behavior unchanged (inline logs shown)
  • ✅ Documented in README

Usage

Users can disable inline console logs when debugging:

{
  "vitest.showInlineConsoleLog": false
}

Or via Settings UI: Search for "Vitest: Show Inline Console Log"

Original prompt

This section details on the original issue you should resolve

<issue_title>Add a way to disable inline console.log</issue_title>
<issue_description>### Clear and concise description of the problem

While debugging tests, it can be very cumbersome:

Image

Suggested solution

Add an extension setting to toggle inline console logs.

Alternative

No response

Additional context

No response

Validations

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits December 22, 2025 13:28
…logs

Co-authored-by: sheremet-va <16173870+sheremet-va@users.noreply.github.com>
Co-authored-by: sheremet-va <16173870+sheremet-va@users.noreply.github.com>
Co-authored-by: sheremet-va <16173870+sheremet-va@users.noreply.github.com>
Copilot AI changed the title [WIP] Add a way to disable inline console.log Add setting to disable inline console logs during test debugging Dec 22, 2025
Copilot AI requested a review from sheremet-va December 22, 2025 13:35
package.json Outdated
"default": true,
"scope": "resource"
},
"vitest.disableInlineConsoleLog": {
Copy link
Member

Choose a reason for hiding this comment

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

@copilot rename it to vitest.showInlineConsoleLog and set it to true by default

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed to vitest.showInlineConsoleLog with default true. The logic has been inverted accordingly. (b54e1f6)

Co-authored-by: sheremet-va <16173870+sheremet-va@users.noreply.github.com>
Copilot AI changed the title Add setting to disable inline console logs during test debugging Add setting to control inline console logs during test debugging Dec 22, 2025
Copilot AI requested a review from sheremet-va December 22, 2025 13:41
Copy link
Member

@sheremet-va sheremet-va left a comment

Choose a reason for hiding this comment

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

@copilot mention showInlineConsoleLog in README

Co-authored-by: sheremet-va <16173870+sheremet-va@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 23, 2025

@copilot mention showInlineConsoleLog in README

Added showInlineConsoleLog to the README documentation in the Configuration section. (9ece48c)

@sheremet-va sheremet-va marked this pull request as ready for review December 27, 2025 20:27
@sheremet-va sheremet-va merged commit ff6e44d into main Dec 27, 2025
1 of 2 checks passed
@sheremet-va sheremet-va deleted the copilot/add-disable-inline-console-log branch December 27, 2025 20:27
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.

Add a way to disable inline console.log

2 participants