Skip to content

TSServer updates entire project when adding a new file #38210

Description

@VincentBailly

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"] }

Activity

  1. VincentBailly commented on Apr 27, 2020

    @VincentBailly
    MemberAuthor

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

  2. sheetalkamat commented on Apr 27, 2020

    @sheetalkamat
    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.

  3. VincentBailly commented on Apr 29, 2020

    @VincentBailly
    MemberAuthor

    Thank you Sheetal Nandi (@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.

  4. sheetalkamat commented on Apr 29, 2020

    @sheetalkamat
    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: Ryan Cavanaugh (@RyanCavanaugh) Daniel Rosenwasser (@DanielRosenwasser)

  5. typescript-bot commented on May 1, 2020

    @typescript-bot
    Contributor

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

  6. VincentBailly commented on May 4, 2020

    @VincentBailly
    MemberAuthor

    Sheetal Nandi (@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.

  7. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions