Skip to content
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

Add sample for incremental compiling and solution builder #225

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sheetalkamat
Copy link
Member

@sheetalkamat sheetalkamat commented Sep 3, 2019

@sheetalkamat sheetalkamat changed the title Add sample for incremental compiling Add sample for incremental compiling and solution builder Sep 4, 2019
...program.getOptionsDiagnostics(),
...program.getGlobalDiagnostics(),
...program.getSemanticDiagnostics() // Get the diagnostics before emit to cache them in the buildInfo file.
];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We not ts.getPreEmitDiagnostics() instead of duplicating the get___Diagnostics() calls?

What about ts.sortAndDeduplicateDiagnostics(diagnostics)?

}

const program = ts.createIncrementalProgram({
rootName: config.fileNames,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: this is rootNames and not rootName

/*optionsToExtend*/ { incremental: true },
/*host*/ {
...ts.sys,
onUnRecoverableConfigFileDiagnostic: d => console.error(ts.flattenDiagnosticMessageText(d, "\n"));
Copy link

@gbalint gbalint Nov 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be:

onUnRecoverableConfigFileDiagnostic: d => console.error(ts.flattenDiagnosticMessageText(d.messageText, "\n"));

Now it throws a compile error:

Argument of type 'Diagnostic' is not assignable to parameter of type 'string | DiagnosticMessageChain | undefined'.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an invalid semi colon at the end

onUnRecoverableConfigFileDiagnostic: d => console.error(ts.flattenDiagnosticMessageText(d.messageText, "\n"));

@orta orta force-pushed the master branch 5 times, most recently from c888fbb to 9927788 Compare November 12, 2019 17:20
@orta orta force-pushed the master branch 3 times, most recently from 5c070ad to fbcbe2a Compare December 16, 2019 16:56
@ahnpnl
Copy link

ahnpnl commented Feb 17, 2020

hi @sheetalkamat , is it possible to have an example of using createIncrementalCompilerHost ? I'm looking at your example in this PR, createIncrementalCompilerHost is mentioned but there is no example usage.

@cspotcode
Copy link

This PR refers to IncrementalCompilerHost, but I can't find where that type is declared. I see that createIncrementalCompilerHost returns a normal CompilerHost.

If possible, it would be great to have an explanation of getSourceFile's argument shouldCreateNewSourceFile. I'm trying to implement an efficient CompilerHost and I'm not sure if I'm allowed to return the same SourceFile instance multiple times from my getSourceFile implementation.

);

// Builds the solution and watches for changes
solution.clean();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be: solution.build()

@perbergland
Copy link

This PR is a goldmine - would be great to see it merged now one year after its creation

@JasonKleban
Copy link

@sheetalkamat is there something outdated about this API that is holding up this documentation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document --incremental and composite project APIs