Skip to content

Conversation

@AryanBagade
Copy link

close #10576

Description

Fix VSCode duplicate-window LSP initialization failure by treating PidlockError::AlreadyOwned as non‑fatal during LSP initialize. This allows a second VSCode window on the same repo to start normally while preserving exclusivity for optimize-only features in the first window.

  • Change: Only in Rust LSP (crates/turborepo-lsp/src/lib.rs) :- when the pidlock is already owned, log an info and continue initializing instead of returning an internal error.
  • No changes to the VSCode extension or daemon protocol.
  • Impact: Low. Normal diagnostics/completions continue to work in multiple windows; the first window retains the exclusive lock for optimize-only features.

Screenshots

  • Left: First dev-host window (lock owner) – initialized OK.
  • Right: Second dev-host window – initialized OK; no errors (non-fatal lock path in effect).
CleanShot 2025-09-05 at 23 50 30@2x

Testing Instructions

  • Run the extension in dev mode using this branch (or use a local build of the LSP as the server).
  • Open dev-host window 1 on the repo; open turbo.json.
  • Open dev-host window 2 on the same repo; open turbo.json.
  • In dev-host, Output → “Turborepo Language Server”.
  • Expected:
    • No init errors.
    • Logs include:

Rationale

The pidlock is used to protect exclusive “optimize” behavior. Regular LSP features (diagnostics, completion, code actions) don’t require exclusivity. Allowing secondary windows to initialize avoids user-facing failures without sacrificing the exclusivity of the first holder.

Affected Code

  • crates/turborepo-lsp/src/lib.rs (initialize path)

Notes for Reviewers

  • Behavior for other pidlock errors (invalid/IO) remains unchanged and fails fast.
  • No changes to extension packaging or daemon protocol.

@AryanBagade AryanBagade requested a review from a team as a code owner September 7, 2025 03:09
@vercel
Copy link
Contributor

vercel bot commented Sep 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
examples-basic-web Ready Ready Preview Comment Sep 25, 2025 9:53pm
examples-designsystem-docs Ready Ready Preview Comment Sep 25, 2025 9:53pm
examples-tailwind-web Ready Ready Preview Comment Sep 25, 2025 9:53pm
examples-vite-web Ready Ready Preview Comment Sep 25, 2025 9:53pm

@vercel
Copy link
Contributor

vercel bot commented Sep 7, 2025

@AryanBagade is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@AryanBagade AryanBagade changed the title LSP: handle pidlock AlreadyOwned without failing init (fixes #10576) fix: lsp handle pidlock AlreadyOwned without failing init (fixes #10576) Sep 9, 2025
@AryanBagade
Copy link
Author

@anthonyshew could you please review the pr!!

@AryanBagade
Copy link
Author

@anthonyshew @tknickman
hello sir,
could you please review the pr!! I’d really appreciate it if you could take a look whenever you get a chance. If there’s anything that needs adjustment or a better approach I could take, I’d love to hear your feedback.

@pattobrien
Copy link

pattobrien commented Nov 6, 2025

@anthonyshew @tknickman could you please see above comment from @AryanBagade and consider approving? would be great to have this fix, as the issue is 100% reproducible every time a new IDE window is opened.

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.

VSCode Extension failures when opening workspace in duplicate window

3 participants