Skip to content

Commit 709e3fc

Browse files
committed
Only get code fixes from declaration diagnostics when --isolatedDeclaration is on.
1 parent 0191a46 commit 709e3fc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/services/codeFixProvider.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,15 @@ export function eachDiagnostic(context: CodeFixAllContext, errorCodes: readonly
124124
}
125125

126126
function getDiagnostics({ program, sourceFile, cancellationToken }: CodeFixContextBase) {
127-
return [
127+
const diagnostics = [
128128
...program.getSemanticDiagnostics(sourceFile, cancellationToken),
129129
...program.getSyntacticDiagnostics(sourceFile, cancellationToken),
130-
...program.getDeclarationDiagnostics(sourceFile, cancellationToken),
131130
...computeSuggestionDiagnostics(sourceFile, program, cancellationToken),
132131
];
132+
if (program.getCompilerOptions().isolatedDeclarations) {
133+
diagnostics.push(
134+
...program.getDeclarationDiagnostics(sourceFile, cancellationToken),
135+
);
136+
}
137+
return diagnostics;
133138
}

0 commit comments

Comments
 (0)