[api] Add createIncrementalProgram - #64401
Andrew Branch (andrewbranch) wants to merge 14 commits into
Conversation
Restore persistent diagnostic and emit state from tsbuildinfo while keeping checker and language-service operations backed by the underlying compiler program. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Avoid exposing the shared program ownership helper as a generated API method and construct fresh compiler options in tests to satisfy no-copy checks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # packages/typescript/src/api/async/api.ts # packages/typescript/src/api/proto.generated.ts # packages/typescript/src/api/sync/api.ts # tsc/internal/project/projectcollectionbuilder.go # tsc/internal/project/snapshot.go Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Trying to integrate this in our build tool. One small issue, |
|
Can you elaborate on the issue? That sounds right to me. A VFS isn't a property of a program, it's something you can apply to a snapshot, and then any programs of any kind you add to that snapshot will use the VFS. |
|
I guess you could argue that since using an incremental program usually involves changing its state by emitting, the convenience method that gives you the program directly without the snapshot makes it kind of confusing... you really need to know how to manage a snapshot if you're going to use an incremental program. |
If we can manage the snapshot ourselves then that is fine I guess. It's juts that the convenience method is of no use to us, but it might be of use to others who don't need to apply a VFS on the snapshot. |
|
I tested our build tool with the changes in this PR. Shape of the API works for us. Everything seems to work. |
|
Great! Do you see performance improvements over using non-incremental programs? |
# Conflicts: # packages/typescript/src/api/async/api.ts # packages/typescript/src/api/sync/api.ts # packages/typescript/test/sync/api-generators.test.ts # tsc/internal/api/proto.go # tsc/internal/api/session.go Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Part of #63875
This is kind of an interesting one. In an incremental program, emitting is a state-changing operation, so this is modeled as a snapshot change:
This was mostly Copilot with a few high-level conceptual corrections from me; implementation still needs a closer review from me.