Skip to content

Conversation

@arcanis
Copy link
Contributor

@arcanis arcanis commented Oct 12, 2025

Let's say you run this:

cd ~/proj-a
zed ~/proj-b

The zed process will execute with current_dir() = ~/proj-a, but a worktree_root_path() = ~/proj-b. The old detection was then checking if the Yarn SDK was installed in proj-a to decide whether to set the tsdk value or not. This was incorrect, as we should instead check for the SDK presence inside proj-b.

Release Notes:

  • Fixed the Yarn SDK detection when the Zed pwd is different from the opened folder.

@cla-bot
Copy link

cla-bot bot commented Oct 12, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @arcanis on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link

cla-bot bot commented Oct 12, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @arcanis on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@arcanis
Copy link
Contributor Author

arcanis commented Oct 12, 2025

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Oct 12, 2025
@cla-bot
Copy link

cla-bot bot commented Oct 12, 2025

The cla-bot has been summoned, and re-checked this pull request!

@maxdeviant maxdeviant changed the title Makes the yarn sdk path relative to the worktree Make the Yarn SDK path relative to the worktree Oct 12, 2025
@osiewicz
Copy link
Contributor

osiewicz commented Oct 12, 2025

Huh, read_text_file should already be relative to the worktree you're working with (and not cwd).. So that sounds to me like a bug elsewhere, if it is an issue indeed.

@osiewicz osiewicz self-assigned this Oct 12, 2025
@arcanis
Copy link
Contributor Author

arcanis commented Oct 13, 2025

My understanding is that it only does so for files that aren't part of an ignore list (gitignore?), otherwise it fails with "no worktree entry".

In our case we want to check unconditionally, since it's conceivable the user would have gitignored the SDK files (in my case it was by mistake as I had incorrect .gitignore entries).

@osiewicz
Copy link
Contributor

Hmm, read_text_file calls entry_for_path:

.entry_for_path(path)
which then uses include_ignored: true to traverse a worktree..
self.traverse_from_path(true, true, true, path)

I don't see why it would ignore these entries.

Don't get me wrong, I appreciate you filing a PR, but I need to do some further digging myself before I'm able to review this (even though the code looks good at glance).

@arcanis
Copy link
Contributor Author

arcanis commented Oct 13, 2025

I might be wrong, but I suspect it's because .yarn was gitignored, so should_scan_directory declined to dig into it, and thus .yarn/sdks/typescript/lib never even appeared in the worktree entries.

@osiewicz
Copy link
Contributor

Ah, yes, you're totally right. entry_for_path will return an entry for a gitignored directory, but not for anything "below it".

@osiewicz osiewicz merged commit 36210e7 into zed-industries:main Oct 20, 2025
25 checks passed
@osiewicz
Copy link
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants