Skip to content

Conversation

abonander
Copy link
Collaborator

Having looked over both #4018 and #4039, neither seemed like a complete solution on its own. Rather than choose which one to bless and still need to have a tedious back and-forth to arrive at a satisfactory solution, I decided to try my hand at it myself.

The major thing both PRs were missing was a way to invalidate the loaded .env and sqlx.toml files after caching, since otherwise the user would need to completely reload RustAnalyzer if they made any changes to either. This necessitated the creation of a wrapper that could watch a set of files and automatically invalidate the cached value if the modified-time on any of them changed.

I also felt that #4018 was just too complex in general while in #4039 I wasn't really comfortable with caching the full contents of the .env file since that could conceivably contain various secrets that we shouldn't be storing, even temporarily.

cc and thanks to both @AlexTMjugador (#4018) and @Diggsey (#4039) for their proposed solutions. I'll be sure to credit your contributions in the changelog. It would be a great help if you both could look this over and let me know if it correctly fixes the issues you've raised. I'd also love your help figuring out how to create a regression test for this since we clearly don't test .env loading well enough in CI.

Does your PR solve an issue?

closes #4018 (superceded PR)
closes #4039 (superceded PR)

Is this a breaking change?

Only with respect to currently unreleased changes.

@abonander abonander force-pushed the ab/fix-dotenv-loading branch from 1b21bc5 to 43cb27a Compare October 8, 2025 01:38
@abonander abonander force-pushed the ab/fix-dotenv-loading branch from 43cb27a to b3f4186 Compare October 8, 2025 01:41
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.

1 participant