Skip to content

issues/2: Add Vscode Insiders Support & Improve Logging - #3

Open
0x3at wants to merge 2 commits into
Sukarth:mainfrom
0x3at:0x3at/vsc-insider-support
Open

issues/2: Add Vscode Insiders Support & Improve Logging#3
0x3at wants to merge 2 commits into
Sukarth:mainfrom
0x3at:0x3at/vsc-insider-support

Conversation

@0x3at

@0x3at 0x3at commented Jul 15, 2025

Copy link
Copy Markdown

feat: Add VS Code Insiders Support & Enhanced Logging

This PR introduces support for VS Code Insiders by extending path resolution to include out/vs/code/electron-browser/workbench/workbench.html. This path reflects the structure used by Insiders, which differs from stable releases by using the electron-browser directory instead of electron-sandbox.

Key Improvements

  • VS Code Insiders Compatibility:
    The extension now recognizes and adapts to the unique directory structure of VS Code Insiders, ensuring proper functionality across both stable and insiders builds.

  • Dedicated Logging Output Channel:
    A specialized output channel has been added for extension logs, separating them from general output and making debugging more straightforward.

  • Debug Report Generation:
    Introduces a utility to generate detailed debug reports, specifically triggered when the workbench.html path cannot be located. This will help users and maintainers diagnose issues and add support for forks or custom builds more easily.

Benefits

  • Greater compatibility with VS Code Insiders Edition.
  • Improved troubleshooting and issue reporting workflows.
  • Easier future support for forks and custom VS Code builds.

Summary by CodeRabbit

  • New Features

    • Enhanced logging with a dedicated output channel for clearer and more detailed extension logs.
    • Added comprehensive debug reporting to assist with troubleshooting and issue reporting.
  • Documentation

    • Updated the README with instructions on accessing extension logs and improved guidance for troubleshooting and bug reports.

0x3at added 2 commits July 14, 2025 21:34
Added the path to the vscode insiders workbench.html to possible paths in the `findWorkbenchPath()` function.
Introduces a dedicated output channel for logging extension messages and errors. Adds debug report generation to assist troubleshooting when the workbench.html path is not detected. Updates made to README `Troubleshooting / FAQ` and `Bug Reports & Feature Requests` sections.
@coderabbitai

coderabbitai Bot commented Jul 15, 2025

Copy link
Copy Markdown

Walkthrough

The changes introduce a centralized logging mechanism using a VS Code Output Channel, replacing all console logging with structured LOGGER methods. A new utility function generates detailed debug reports for troubleshooting. The README is updated to instruct users to include output channel logs in bug reports. No core logic or control flow is altered.

Changes

File(s) Change Summary
README.md Added FAQ entry and updated troubleshooting/bug report instructions to include extension logs.
src/extension.ts, out/extension.js Introduced LOGGER output channel for all logging; replaced console calls; added generateDebugReport utility for detailed diagnostics; enhanced logging in file operations and activation; no core logic changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Extension
    participant VSCode Output Channel

    User->>Extension: Activates extension
    Extension->>VSCode Output Channel: LOGGER.info("Extension activated")
    Extension->>Extension: Attempts to find workbench.html
    alt Path not found
        Extension->>Extension: generateDebugReport()
        Extension->>VSCode Output Channel: LOGGER.error(debug report)
    end
    Extension->>VSCode Output Channel: Logs all info/warn/error/debug messages
Loading

Poem

🐇
A log for every hop and leap,
Through output channels, secrets keep.
When bugs appear, don’t fear or groan—
The debug report will set the tone.
With every info, warn, or cheer,
The rabbit logs it crystal clear!

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🔭 Outside diff range comments (5)
out/extension.js (3)

154-158: Incomplete migration from console logging to LOGGER.

Several console.log, console.error, and console.warn calls remain in the temporary file cleanup sections. For consistency with the PR objectives, these should also use the LOGGER.

Replace the remaining console calls:

-                            console.log(`Successfully deleted temp file: ${tempFileUri.fsPath}`);
+                            LOGGER.info(`Successfully deleted temp file: ${tempFileUri.fsPath}`);
                         } catch (deleteError) {
-                            console.error(`Failed to delete temp file: ${deleteError.message}`);
+                            LOGGER.error(`Failed to delete temp file: ${deleteError.message}`);
                         }
-                        console.log('Sudo command successful.');
+                        LOGGER.info('Sudo command successful.');
                         // Attempt to clean up the temporary file after successful move
                         try {
                             await vscode.workspace.fs.delete(tempFileUri);
-                            console.log(`Successfully deleted temp file after move: ${tempFileUri.fsPath}`);
+                            LOGGER.info(`Successfully deleted temp file after move: ${tempFileUri.fsPath}`);
                         } catch (deleteError) {
                             // Log warning if deletion fails (might already be gone)
-                            console.warn(`Could not delete temp file after successful move (might already be gone): ${deleteError.message}`);
+                            LOGGER.warn(`Could not delete temp file after successful move (might already be gone): ${deleteError.message}`);

Also applies to: 166-172


489-508: Console calls remain in the activate and deactivate functions.

Multiple console calls in the activation logic should be replaced with LOGGER for consistency:

  • Lines 490, 499, 503, 507: Theme application logs
  • Lines 527, 533, 545, 553, 561: Version and configuration logs
  • Line 571: Activation success log
  • Line 579: Deactivation log

Also applies to: 527-527, 533-533, 545-545, 553-553, 561-561, 571-571, 579-579


278-285: Replace all remaining console calls with LOGGER methods

To maintain consistency with the PR’s objective of standardizing logging, every console.log, console.warn, and console.error in out/extension.js should be migrated to the corresponding LOGGER method:

• Info-level (console.logLOGGER.info): lines 154, 163, 167, 278, 285, 351, 356, 490, 495, 500, 533, 541, 555, 559, 565, 571, 579
• Warn-level (console.warnLOGGER.warn): lines 171, 336
• Error-level (console.errorLOGGER.error): lines 157, 298, 308, 367, 381, 527
• Inline error handlers in catches (e.g. applyStyles().catch(err => console.error(...))): lines 543, 561

Please update each occurrence to use the appropriate LOGGER call.

src/extension.ts (2)

124-127: Replace remaining console calls with LOGGER in temp file operations.

For consistency with the new logging approach, replace these console calls:

-                            console.log(`Successfully deleted temp file: ${tempFileUri.fsPath}`);
+                            LOGGER.info(`Successfully deleted temp file: ${tempFileUri.fsPath}`);
                         } catch (deleteError: any) {
-                            console.error(`Failed to delete temp file: ${deleteError.message}`);
+                            LOGGER.error(`Failed to delete temp file: ${deleteError.message}`);
-                        console.log('Sudo command successful.');
+                        LOGGER.info('Sudo command successful.');
                         // Attempt to clean up the temporary file after successful move
                         try {
                             await vscode.workspace.fs.delete(tempFileUri);
-                            console.log(`Successfully deleted temp file after move: ${tempFileUri.fsPath}`);
+                            LOGGER.info(`Successfully deleted temp file after move: ${tempFileUri.fsPath}`);
                         } catch (deleteError: any) {
                             // Log warning if deletion fails (might already be gone)
-                            console.warn(`Could not delete temp file after successful move (might already be gone): ${deleteError.message}`);
+                            LOGGER.warn(`Could not delete temp file after successful move (might already be gone): ${deleteError.message}`);

Also applies to: 133-141


262-268: Multiple console calls remain; migrate them to LOGGER

To complete the PR goal of using a dedicated output channel, all console.log, console.error, and console.warn calls in src/extension.ts must be replaced with appropriate LOGGER methods. Please update the following occurrences:

  • File operations (temp files & sudo)

    • Line 124: console.log('Successfully deleted temp file: …')
    • Line 126: console.error('Failed to delete temp file: …')
    • Line 133: console.log('Sudo command successful.')
    • Line 137: console.log('Successfully deleted temp file after move: …')
    • Line 140: console.warn('Could not delete temp file after successful move: …')
  • Theme management

    • Line 262: console.log('Storing current theme: …')
    • Line 268: console.log('Auto theme apply skipped. …')
    • Line 344: console.log('Storing previous theme: …')
    • Line 348: console.log('Theme reversion skipped. …')
    • Line 499: console.log('Applying pending theme change to: …')
    • Line 503: console.log('Applying pending theme revert to: …')
    • Line 507: console.log('No pending theme changes to apply on activation')
  • Style injection & removal errors

    • Line 282: console.error('Failed to write workbench.html.')
    • Line 294: console.error('Error applying styles: …')
    • Line 326: console.warn('Injection markers not found…')
    • Line 360: console.error('Failed to write workbench.html during style removal.')
    • Line 376: console.error('Error removing styles: …')
  • Version/update logs

    • Line 545: console.error('Failed to read package.json: …')
    • Line 553: console.log('Version change detected (Stored: …)')
    • Line 561: console.log('Re-applying styles after update.')
    • Line 563:
      applyStyles().catch(err =>
        console.error('Error during automatic style re-application after update:', err)
      );
  • Config‐change notifications

    • Line 578: console.log('Relevant configuration changed.')
    • Line 582: console.log('Styles are applied, re-applying due to config change.')
    • Line 584:
      applyStyles().catch(err =>
        console.error('Error during automatic style re-application after config change:', err)
      );
    • Line 587: console.log('Config changed, but styles are not currently applied. No action needed.')
  • Activation/Deactivation

    • Line 595: console.log('… activated successfully (Version: …)')
    • Line 604: console.log('… deactivated.')

Replace each with the corresponding LOGGER.info(), LOGGER.error(), or LOGGER.warn() call so all extension messages use the shared output channel.

🧹 Nitpick comments (1)
src/extension.ts (1)

382-484: Excellent implementation of the debug report utility.

The generateDebugReport function provides comprehensive system and installation information that will be invaluable for troubleshooting. The error handling ensures the function doesn't fail even if some information can't be retrieved.

Consider adding VS Code extension host information to help identify whether the extension is running in a regular window vs. a remote/WSL context:

Extension Host: ${vscode.env.isNewAppInstall ? 'New Install' : 'Existing'}
UI Kind: ${vscode.env.uiKind === vscode.UIKind.Desktop ? 'Desktop' : 'Web'}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 728ee5b and 79022d9.

⛔ Files ignored due to path filters (1)
  • out/extension.js.map is excluded by !**/*.map
📒 Files selected for processing (3)
  • README.md (3 hunks)
  • out/extension.js (8 hunks)
  • src/extension.ts (9 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
out/extension.js

[error] 36-36: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 405-405: Avoid redundant double-negation.

It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation

(lint/complexity/noExtraBooleanCast)


[error] 406-406: Avoid redundant double-negation.

It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation

(lint/complexity/noExtraBooleanCast)

src/extension.ts

[error] 404-404: Avoid redundant double-negation.

It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation

(lint/complexity/noExtraBooleanCast)


[error] 405-405: Avoid redundant double-negation.

It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation

(lint/complexity/noExtraBooleanCast)

🔇 Additional comments (3)
README.md (1)

104-106: Documentation updates align well with the new logging functionality.

The new FAQ entry clearly explains how to access the extension logs, and the bug report instructions appropriately request users to include these logs. This will significantly improve the debugging and support process.

Also applies to: 125-125

out/extension.js (1)

72-107: Excellent implementation of VS Code Insiders support and comprehensive error reporting.

The addition of the electron-browser path for VS Code Insiders is correctly implemented. The enhanced logging provides valuable debugging information, and the debug report generation on failure will greatly assist in troubleshooting path-related issues.

src/extension.ts (1)

8-11: Well-implemented logging infrastructure and VS Code Insiders support.

The LOGGER initialization with the output channel is properly configured, and the enhanced path discovery with detailed logging will greatly improve debugging capabilities. The VS Code Insiders path addition is correctly placed.

Also applies to: 37-71

Comment thread out/extension.js
Comment on lines +405 to +406
readAccess = !!(mode & 0o444) ? "True" : "False";
writeAccess = !!(mode & 0o222) ? "True" : "False";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove redundant double negation as flagged by static analysis.

The double negation (!!) is unnecessary here since the result is being converted to a string anyway.

Apply this fix:

-        readAccess = !!(mode & 0o444) ? "True" : "False";
-        writeAccess = !!(mode & 0o222) ? "True" : "False";
+        readAccess = (mode & 0o444) ? "True" : "False";
+        writeAccess = (mode & 0o222) ? "True" : "False";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
readAccess = !!(mode & 0o444) ? "True" : "False";
writeAccess = !!(mode & 0o222) ? "True" : "False";
readAccess = (mode & 0o444) ? "True" : "False";
writeAccess = (mode & 0o222) ? "True" : "False";
🧰 Tools
🪛 Biome (1.9.4)

[error] 405-405: Avoid redundant double-negation.

It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation

(lint/complexity/noExtraBooleanCast)


[error] 406-406: Avoid redundant double-negation.

It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation

(lint/complexity/noExtraBooleanCast)

🤖 Prompt for AI Agents
In out/extension.js at lines 405 to 406, remove the redundant double negation
(!!) from the assignments to readAccess and writeAccess. Since the ternary
operator converts the result to the strings "True" or "False", the double
negation is unnecessary. Simply check the bitwise condition directly in the
ternary expression without using !!.

Comment thread src/extension.ts
Comment on lines +404 to +405
readAccess = !!(mode & 0o444) ? "True" : "False";
writeAccess = !!(mode & 0o222) ? "True" : "False";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove redundant double negation operators.

The static analysis tool correctly identified unnecessary double negation.

-        readAccess = !!(mode & 0o444) ? "True" : "False";
-        writeAccess = !!(mode & 0o222) ? "True" : "False";
+        readAccess = (mode & 0o444) ? "True" : "False";
+        writeAccess = (mode & 0o222) ? "True" : "False";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
readAccess = !!(mode & 0o444) ? "True" : "False";
writeAccess = !!(mode & 0o222) ? "True" : "False";
readAccess = (mode & 0o444) ? "True" : "False";
writeAccess = (mode & 0o222) ? "True" : "False";
🧰 Tools
🪛 Biome (1.9.4)

[error] 404-404: Avoid redundant double-negation.

It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation

(lint/complexity/noExtraBooleanCast)


[error] 405-405: Avoid redundant double-negation.

It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation

(lint/complexity/noExtraBooleanCast)

🤖 Prompt for AI Agents
In src/extension.ts around lines 404 to 405, remove the redundant double
negation operators (!!) used before the bitwise checks on mode. Instead of using
!!(mode & 0o444) and !!(mode & 0o222), directly use the truthiness of (mode &
0o444) and (mode & 0o222) to assign "True" or "False" to readAccess and
writeAccess respectively.

@0x3at 0x3at changed the title Add Vscode Insiders Support & Improved Logging issues/2: Add Vscode Insiders Support & Improve Logging Jul 15, 2025
@0x3at

0x3at commented Jul 23, 2025

Copy link
Copy Markdown
Author

Bump

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.

1 participant