MCPcopy Create free account
hub / github.com/nodejs/node / getDiagnosticsWithPrecedingDirectives

Function getDiagnosticsWithPrecedingDirectives

test/fixtures/snapshot/typescript.js:117669–117675  ·  view source on GitHub ↗

* Creates a map of comment directives along with the diagnostics immediately preceded by one of them. * Comments that match to any of those diagnostics are marked as used.

(sourceFile, commentDirectives, flatDiagnostics)

Source from the content-addressed store, hash-verified

117667 * Comments that match to any of those diagnostics are marked as used.
117668 */
117669 function getDiagnosticsWithPrecedingDirectives(sourceFile, commentDirectives, flatDiagnostics) {
117670 // Diagnostics are only reported if there is no comment directive preceding them
117671 // This will modify the directives map by marking "used" ones with a corresponding diagnostic
117672 var directives = ts.createCommentDirectivesMap(sourceFile, commentDirectives);
117673 var diagnostics = flatDiagnostics.filter(function (diagnostic) { return markPrecedingCommentDirectiveLine(diagnostic, directives) === -1; });
117674 return { diagnostics: diagnostics, directives: directives };
117675 }
117676 function getSuggestionDiagnostics(sourceFile, cancellationToken) {
117677 return runWithCancellationToken(function () {
117678 return getTypeChecker().getSuggestionDiagnostics(sourceFile, cancellationToken);

Callers 2

getProgramDiagnosticsFunction · 0.85

Calls 2

filterMethod · 0.65

Tested by

no test coverage detected