Skip to content

TSServer updates entire project when adding a new file #38210

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

Closed
VincentBailly opened this issue Apr 27, 2020 · 6 comments
Closed

TSServer updates entire project when adding a new file #38210

VincentBailly opened this issue Apr 27, 2020 · 6 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@VincentBailly
Copy link
Member

VincentBailly commented Apr 27, 2020

When using { "include" : ["."] } in tsconfig, TSServer takes a lot of time when adding a new file compared to when using { "files": ["./index.ts"] }.
It would be tedious to have to maintain a list of exported modules in tsconfig.json simply to get faster refactoring experience.

TypeScript Version: 3.9.0-dev.20200427

Search Terms:

VSCode
IntelliSense
Include
Files
TSServer

Code

See repro here

Expected behavior:

When adding a new file to a project the amount of work done by TSServer is independent of the amount of code present in the project.

Actual behavior:

When using { "include": ["."] } adding a new file seems to trigger a lot of work for TSServer, and this work seems to depend on the amount of code already in this project.
Note that this does not happen when we use { "files": ["./index.ts"] }

@VincentBailly
Copy link
Member Author

Also note that in composite projects it is not maintainable to use "Files" because we would need to specify every single file.

@sheetalkamat
Copy link
Member

This is working as intended since when you are not specifying include file, the new file is part of the existing project so that project is updated.

@sheetalkamat sheetalkamat added the Working as Intended The behavior described is the intended behavior; this is not a bug label Apr 27, 2020
@VincentBailly
Copy link
Member Author

Thank you @sheetalkamat for the quick answer.

A bit a context:
Our repository contains 250+ packages/projects. We chose to use project references for the better IntelliSense experience it brings in most scenarios. Developers working on our repo as well as other large repos report that the IntelliSense experience when refactoring is way better in the repos that don't use project references.

So we are isolating scenarios that are slow when refactoring; creating a new file is one of them. It is not clear why TSServer needs to do a lot of work when we create a new empty file.

Without using project references, we would specify in our tsconfig the list of entry files of the project. With this setup creating a new empty file and opening it is super fast but we can't get this experience with project references.

Would it be prioritized to improve some refactoring scenarios to make them as fast as without project-references? If so we are willing to provide you with a number of small repros for problems which contribute to the overall frustration of our developers.

@sheetalkamat
Copy link
Member

Our repository contains 250+ packages/projects. We chose to use project references for the better IntelliSense experience it brings in most scenarios. Developers working on our repo as well as other large repos report that the IntelliSense experience when refactoring is way better in the repos that don't use project references.

Would like to know more about why the refactoring experience is better without project references. We have made lot of changes to ensure refactoring with project references is more complete.

So we are isolating scenarios that are slow when refactoring; creating a new file is one of them. It is not clear why TSServer needs to do a lot of work when we create a new empty file.

New file when created as mentioned earlier is part of the existing project and hence that needs to be updated. We also made some changes recently to our resolution cache to handle new file creation specifically #37055 and #37121 and are part of 3.9 so would like feedback and/or repro with latest changes to be able to see what more needs to be done

cc: @RyanCavanaugh @DanielRosenwasser

@typescript-bot
Copy link
Collaborator

This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@VincentBailly
Copy link
Member Author

@sheetalkamat We are currently on TS 3.8, The perf improvement brought by 3.9 are exciting. We are going to re-evaluate the perf of refactoring in our repo once we move to 3.9. If the issues we have been experiencing persist then we will open other bugs with specific repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

3 participants