-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Dont open composite projects to determine if script info is part of project #59688
Conversation
Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page. Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up. |
73bb862
to
f4617d0
Compare
Reading |
@typescript-bot pack this |
Hey @DanielRosenwasser, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
That really depends on what we would want to do with that. The thing I could imagine is that an editor, when encountering a TypeScript file, could indicate that the file belongs to no projects and that there might be a configuration error. For a JavaScript file, I think that's way more questionable. |
Its so interesting how most of fourslash-server tests work. They open files that are |
e9f9c08
to
b9d3647
Compare
b9d3647
to
7fce70a
Compare
Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @mjbvz, @zkat, and @joj for you. Feel free to loop in other consumers/maintainers if necessary. |
a499360
to
e513c3e
Compare
…or file This adds createReplay which behaves like create but (does not create project and does not short circuit if we find project early)
efc1647
to
639210a
Compare
I'm trying to find in the baselines a good example of where we would (in the old method) would have been loading too much, but we aren't after this new method; is there a good example of this? |
There are quite a few tests in But here are few:
|
Thanks, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not tested it on our examples of over-loading, but the baseline diffs seem right. PR needs a rebase, though.
@DanielRosenwasser maybe you have a good test case for this?
Small feedback from our monorepo (>300 TS projects). Opening some random configuration script, for example, 5.5.4 - "Initialize JS/TS language features" takes ~60 seconds, tsserver process uses ~1.5GB memory We didn't even know just how much we needed this change, thank you! |
very cool, it solved our stubborn problem. |
Projects now load by reading config file and getting root files. If the config marks project as composite, the project isnt loaded right away to determine if opened script info belongs to it. Instead if root file names has fileName of script info we are opening, or if its matched by file/include/exclude in case of extra files (like
.vue
which is handled by plugins) then open that project.This also adds back change for #57196
Open questions now handled
Right now, if we can't find open project, just like before we send
configDiag
(which is errors from the project) for all the projects we loaded as part of lookup. But this is not complete list anymore because we might not create projects that are not needed. Should we add new event that gives list of all the config files looked up. d18d9bc handles this by addingneedDefaultConfiguredProjectInfo
toProjectInfo
request to get information about tsconfig files looked up that didnt match by roots and projects that were loaded but determined to not be default projectsThere are two
getFileReferences
test which were baselining file references across two projects. I am not sure what the expected behavior is butfouslash-server
tests for both these opentsconfig.json
file which goes into inferred project and doesn't open the referenced projects. I have for now updated test to open files from the expected projects that are supposed to be open. But is it supposed to behave like find all references? where it tries to load project tree and get the references after that? Tests aregetFileReferences_deduplicate.ts
andgetFileReferences_server2.ts
Fixed in 4c7280c to handle it similar to find all references to open and load ancestor projects