Skip to content

Add sample for incremental compiling and solution builder - #225

Open
Sheetal Nandi (sheetalkamat) wants to merge 3 commits into
mainfrom
documentIncremental
Open

Add sample for incremental compiling and solution builder#225
Sheetal Nandi (sheetalkamat) wants to merge 3 commits into
mainfrom
documentIncremental

Conversation

@sheetalkamat

@sheetalkamat Sheetal Nandi (sheetalkamat) commented Sep 3, 2019

Copy link
Copy Markdown
Member

@sheetalkamat Sheetal Nandi (sheetalkamat) changed the title Add sample for incremental compiling Add sample for incremental compiling and solution builder Sep 4, 2019
Comment thread Using-the-Compiler-API.md Outdated
Comment thread Using-the-Compiler-API.md
...program.getOptionsDiagnostics(),
...program.getGlobalDiagnostics(),
...program.getSemanticDiagnostics() // Get the diagnostics before emit to cache them in the buildInfo file.
];

Copy link
Copy Markdown

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)?

Comment thread Using-the-Compiler-API.md
}

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

Copy link
Copy Markdown

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

Comment thread Using-the-Compiler-API.md
/*optionsToExtend*/ { incremental: true },
/*host*/ {
...ts.sys,
onUnRecoverableConfigFileDiagnostic: d => console.error(ts.flattenDiagnosticMessageText(d, "\n"));

@gbalint Balint Gabor (gbalint) Nov 7, 2019

Copy link
Copy Markdown

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"));

@ahnpnl

Copy link
Copy Markdown

hi Sheetal Nandi (@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
Copy Markdown

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.

Comment thread Using-the-Compiler-API.md
);

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

Copy link
Copy Markdown

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
Copy Markdown

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

@JasonKleban

Copy link
Copy Markdown

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