Skip to content

Conversation

@mohammedahmed18
Copy link
Contributor

@mohammedahmed18 mohammedahmed18 commented Jul 3, 2025

User description

importing a module like codeflash.cli_cmds.console or any module that imports it, sets the logging level to INFO before the LSP server starts.

As a result, pygls logs messages to stdout at the INFO level, so the vscode lsp client try to treat those as RPC messages and fails.

This was resolved by setting console.quiet in __init__.py.

with console.quiet in if __name__ == "__main__"

2025-07-03-174909_hyprshot

with console.quiet in __init__.py

2025-07-03-174922_hyprshot


PR Type

Bug fix, Enhancement


Description

  • Silence console globally to prevent stdout pollution

  • Remove redundant console silencing in entrypoint

  • Add return type annotation to setup_logging()

  • Tidy imports, mappings, and formatting


Changes walkthrough 📝

Relevant files
Configuration changes
__init__.py
Silence console module on import                                                 

codeflash/lsp/init.py

  • Imported console from codeflash.cli_cmds.console
  • Set console.quiet = True on package import
  • Added comment explaining silencing rationale
  • +4/-0     
    Formatting
    server.py
    Format imports and log mapping                                                     

    codeflash/lsp/server.py

  • Reordered lsprotocol.types imports
  • Added trailing commas in message type mapping
  • Cleaned up whitespace in show_message_log
  • +7/-6     
    server_entry.py
    Refactor entrypoint comments and typing                                   

    codeflash/lsp/server_entry.py

  • Converted docstring to commented header
  • Annotated setup_logging() return type
  • Removed redundant console silencing block
  • +6/-13   

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @mohammedahmed18 mohammedahmed18 requested review from KRRT7 and Saga4 and removed request for Saga4 July 3, 2025 14:56
    @github-actions
    Copy link

    github-actions bot commented Jul 3, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Global silencing

    Silencing the console module at import time can cause unintended side effects in other contexts; consider restricting this change to only the LSP startup path.

    console.quiet = True
    Unused import

    INITIALIZE is imported from lsprotocol.types but not used in the shown code; remove unused imports to keep the module clean.

    from lsprotocol.types import INITIALIZE, LogMessageParams, MessageType

    @github-actions
    Copy link

    github-actions bot commented Jul 3, 2025

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @mohammedahmed18 mohammedahmed18 changed the title [FIX] Set the console to quiet in the package init [FIX][LSP] Set the console to quiet in the package init Jul 3, 2025
    @mohammedahmed18 mohammedahmed18 enabled auto-merge July 3, 2025 15:24
    @mohammedahmed18 mohammedahmed18 merged commit 4b4f1c1 into main Jul 3, 2025
    16 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    2 participants