-
Notifications
You must be signed in to change notification settings - Fork 608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rush] DISCUSSION: project references for VSCode experience improvement #2604
Comments
The problem: I open VSCode at the root of my monorepo as a workspace (or as some constellation of it's projects). I go to package Proposed Solution: If my Limitations of references:
|
We could add support for this in Heft's TypeScript builder without having to touch the Just spitballing, but how cumbersome would it be to have |
for reference: microsoft/TypeScript#25376 typescript is considering adding that same inference, but the trick is differing patterns between types of workspace implementations. so if rush or heft wants to do this automatically it will need to consider which installer is used and how they do workspaces. i love the idea of this happening automatically however, even if it was just supported for pnpm |
The tsconfig changes would be pretty simple, so shouldn't be too complex to add to |
ok found another pretty major gotcha. this one is worth discussing i think, but i'll add it as 5 to the list above as well. if i use project references internally to a project we have problems. so if in
neither of these is great because in 1) we have to write a script that knows the sub package dependencies and compiles them all in order which is terrible and reinvents the wheel of what tsc --build does. In 2) running with that flag will cause typescript not only to compile Not sure what the answer is here:
(i've added an example of it to the repo, you just need to comment in the reference in |
Stumbled across this issue trying to look up solutions to being able to use Find All References across projects and refactoring across all projects. It seems like the only solution is to use project references to cause the TypeScript language server to actually load all the projects in the repo, instead of just the ones you have open files for. Did any further progress get made on investigating this or figuring out best practices for doing it in Rush? I'm not quite clear on how all the project references fit together but my impression is that the following needs to be done
Unclear on 2, I believe that needs to have I don't see any configuration to set this up for the Rush monorepo, is this just something you aren't concerned about (seeing references across projects/refactoring etc) or is there another solution I'm missing? Edit: I received an email about a comment reply mentioning declaration maps, but I don't see it? Anyway, all the projects are configured to use declaration maps so go to definition works great across projects. It's just references/refactoring that don't since only the open typescript projects in VSCode are loaded and accessible to the typescript language server |
In this Zulip thread
we determined that TypeScript project references do make sense to use in
a Rush repo, for the purposes of improving the VS Code experience,
even if they are not used during the actual build.
Here's a sample repo for illustration: https://github.com/creditiq/simple-repros/tree/rush-project-references
This uses a script to sync the references automatically from pnmp workspace deps to tsconfig, but that's not strictly required (it's just really onerous to have to relist the deps otherwise). I believe there are tools that do the same for yarn and maybe npm workspaces as well.
The text was updated successfully, but these errors were encountered: