Write TCP server port to a tempfile instead of using env var - #3452
Merged
vinistock merged 2 commits intoMay 5, 2025
Merged
Conversation
Member
Author
How to use the Graphite Merge QueueAdd 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
marked this pull request as ready for review
May 2, 2025 19:21
vinistock
force-pushed
the
05-02-write_tcp_server_port_to_a_tempfile_instead_of_using_env_var
branch
2 times, most recently
from
May 2, 2025 19:53
17aabe4 to
fb817c8
Compare
vinistock
force-pushed
the
05-02-write_tcp_server_port_to_a_tempfile_instead_of_using_env_var
branch
from
May 2, 2025 21:01
fb817c8 to
5fac84e
Compare
vinistock
force-pushed
the
05-02-write_tcp_server_port_to_a_tempfile_instead_of_using_env_var
branch
from
May 2, 2025 21:09
5fac84e to
45dae57
Compare
amomchilov
approved these changes
May 5, 2025
amomchilov
left a comment
Contributor
There was a problem hiding this comment.
Some questions, but LGTM overall
Co-authored-by: Alexander Momchilov <amomchilov@users.noreply.github.com>
vinistock
deleted the
05-02-write_tcp_server_port_to_a_tempfile_instead_of_using_env_var
branch
May 5, 2025 20:26
st0012
added a commit
to st0012/ruby-lsp-rspec
that referenced
this pull request
May 10, 2025
st0012
added a commit
to st0012/ruby-lsp-rspec
that referenced
this pull request
May 10, 2025
* WIP * Implement RSpec command resolution * Support streaming RSpec results * Generate ids purely based on locations This makes sure that we can always match the ids even for anonymous examples. * Add tests for the rspec formatter * Don't fail fast on CI * Allow RSpecFormatter to not have typed: strict * Requires ruby-lsp 0.23.17 For Shopify/ruby-lsp#3452
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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
runobject to use for reporting the items' statuses. We need to create arunobject on demand when not running through the explorer, otherwise the statuses won't appear as expected.