Skip to content

Keep the output channel of the language server across restarts - #29

Merged
bouweandela merged 1 commit into
mainfrom
keep-output-channel
Nov 4, 2026
Merged

bouweandela merged 1 commit into
mainfrom
keep-output-channel

Conversation

@bouweandela

Copy link
Copy Markdown
Member

The language client closes an output channel that it created itself when it stops. The language server can still log after that, for example a warning from a slow ESGF query or from pygls about a request that arrived during shutdown. Writing that line to the closed channel throws an uncaught Channel has been closed error in the extension host.

This made the VSCode stable job fail intermittently, on whichever test was running at the time, as in #22.

The extension now creates one output channel for its whole lifetime and passes it to each client, so the client does not close it. This also keeps the logs of the previous language server after a restart, instead of replacing the channel.

Testing

I added a test that fails with this error without the fix. It writes to the channel after a restart. To do that, the extension's test API now exposes outputChannel.

Repeated runs of the VSCode tests with VSCode stable, on Xvfb:

Code Failed runs
main, without the fix 1 of 8
#22, without the fix 4 of 8
main with the fix 0 of 8
#22 with the fix 0 of 8

🤖 Generated with Claude Code

The language client closes an output channel that it created itself when it
stops. If the language server logs anything after that, writing to the closed
channel throws an uncaught error in the extension host. Use a single channel
for the lifetime of the extension instead. This also keeps the logs of the
previous language server when it restarts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.71%. Comparing base (ef9d34f) to head (af1011f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #29      +/-   ##
==========================================
+ Coverage   93.67%   93.71%   +0.03%     
==========================================
  Files          21       21              
  Lines        2325     2339      +14     
  Branches      350      350              
==========================================
+ Hits         2178     2192      +14     
  Misses        110      110              
  Partials       37       37              
Flag Coverage Δ
default 95.64% <ø> (ø)
py312 95.64% <ø> (ø)
vscode-1.93.0 82.94% <100.00%> (+0.64%) ⬆️
vscode-stable 82.94% <100.00%> (+0.64%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bouweandela
bouweandela merged commit c9300de into main Nov 4, 2026
5 of 6 checks passed
@bouweandela
bouweandela deleted the keep-output-channel branch November 4, 2026 21:38
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