Skip to content

Write TCP server port to a tempfile instead of using env var #3452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vinistock
Copy link
Member

@vinistock vinistock commented May 2, 2025

Motivation

The strategy of passing the port to LSP reporter via environment variable is a bit weak. For example, if you reload VS Code and then proceed to run tests manually in a terminal that we set up, you will get a connection refused error because we never updated the port variable in that old terminal.

I think we can be a lot more reliable by writing the port to a file.

Implementation

Every workspace reports test results through the same port, so my idea is to write a temporary file with the port information that the LSP reporter can read on its own.

That way, every time the extension reloads, we update the port in the file and, every time the tests are executed (regardless if it's manual or through the explorer), we will read that value again ensuring that we're using the right port.

Finally, I noticed one more hurdle. When running tests manually through the terminal, we were receiving the connection okay, but there was no run object to use for reporting the items' statuses. We need to create a run object on demand when not running through the explorer, otherwise the statuses won't appear as expected.

@vinistock vinistock added vscode This pull request should be included in the VS Code extension's release notes bugfix This PR will fix an existing bug labels May 2, 2025 — with Graphite App
Copy link
Member Author


How to use the Graphite Merge Queue

Add the label graphite-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vinistock vinistock self-assigned this May 2, 2025
@vinistock vinistock requested review from alexcrocha and st0012 May 2, 2025 19:16
@vinistock vinistock marked this pull request as ready for review May 2, 2025 19:21
@vinistock vinistock requested a review from a team as a code owner May 2, 2025 19:21
@vinistock vinistock force-pushed the 05-02-write_tcp_server_port_to_a_tempfile_instead_of_using_env_var branch 2 times, most recently from 17aabe4 to fb817c8 Compare May 2, 2025 19:53
@vinistock vinistock requested a review from amomchilov May 2, 2025 20:08
@vinistock vinistock force-pushed the 05-02-write_tcp_server_port_to_a_tempfile_instead_of_using_env_var branch from fb817c8 to 5fac84e Compare May 2, 2025 21:01
@vinistock vinistock force-pushed the 05-02-write_tcp_server_port_to_a_tempfile_instead_of_using_env_var branch from 5fac84e to 45dae57 Compare May 2, 2025 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug vscode This pull request should be included in the VS Code extension's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant