fix(lsp): fix oxlint LSP race condition on --help stdout read#21887
Open
offlinehacker wants to merge 1 commit intoanomalyco:devfrom
Open
fix(lsp): fix oxlint LSP race condition on --help stdout read#21887offlinehacker wants to merge 1 commit intoanomalyco:devfrom
offlinehacker wants to merge 1 commit intoanomalyco:devfrom
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Related PR Found#16425 - fix(lsp): fix oxlint --lsp detection regression from Bun→Node migration This PR is related to the current PR (#21887) as it addresses a previous oxlint LSP detection issue from a Bun to Node migration. The current PR appears to be fixing a race condition in that same detection logic, so there may be shared context or related fixes between them. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
3 tasks
d5fb1c2 to
87fde81
Compare
Read stdout concurrently with proc.exited using Promise.all to prevent
the stream from being drained before reading. Also use Process.spawn
with explicit { stdout: "pipe" } instead of the LSP spawn wrapper,
and remove the dead oxc_language_server fallback path since it is not
shipped as a bin entry in the oxlint npm package.
Fixes anomalyco#17597
Fixes anomalyco#16309
87fde81 to
3181a2b
Compare
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.
Issue for this PR
Closes #17597
Closes #16309
Type of change
What does this PR do?
The oxlint LSP never starts because the detection code awaits
proc.exitedbefore readingproc.stdout. By the timetext(proc.stdout)runs, the stream is already drained, yielding an empty string — sohelp.includes("--lsp")is always false.Fix: read stdout concurrently with
proc.exitedviaPromise.all. Also switched toProcess.spawnwith{ stdout: "pipe" }instead of the LSPspawnwrapper (which forces stdin/stdout/stderr pipes and is meant for running the actual LSP server, not a one-off--helpcheck). Removed theoxc_language_serverfallback since it's not a bin entry in the oxlint npm package.How did you verify your code works?
Promise.allyields 6142 bytes with--lsppresent.opencode runviabun devagainst a test project with.oxlintrc.jsonand a.tsfile. Logs confirm the LSP starts:Screenshots / recordings
Not a UI change.
Checklist