mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Allow compile on save with decorator emit
This commit is contained in:
parent
0cab79fc56
commit
c0f187a4e8
@ -1599,6 +1599,10 @@ namespace ts.server {
|
||||
return emptyArray;
|
||||
}
|
||||
|
||||
function dtsChangeCanAffectEmit(compilationSettings: CompilerOptions) {
|
||||
return getEmitDeclarations(compilationSettings) || !!compilationSettings.emitDecoratorMetadata;
|
||||
}
|
||||
|
||||
return combineProjectOutput(
|
||||
info,
|
||||
path => this.projectService.getScriptInfoForPath(path)!,
|
||||
@ -1610,8 +1614,8 @@ namespace ts.server {
|
||||
|
||||
const compilationSettings = project.getCompilationSettings();
|
||||
|
||||
if (!!compilationSettings.noEmit || fileExtensionIs(info.fileName, Extension.Dts) && !getEmitDeclarations(compilationSettings)) {
|
||||
// avoid triggering emit when a change is made in a .d.ts when declaration emit is disabled
|
||||
if (!!compilationSettings.noEmit || fileExtensionIs(info.fileName, Extension.Dts) && !dtsChangeCanAffectEmit(compilationSettings)) {
|
||||
// avoid triggering emit when a change is made in a .d.ts when declaration emit and decorator metadata emit are disabled
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@ -598,6 +598,15 @@ namespace ts.projectSystem {
|
||||
/*expectDTSEmit*/ true
|
||||
);
|
||||
});
|
||||
|
||||
it("should return results if change is made in a global declaration file with decorator emit enabled", () => {
|
||||
testDTS(
|
||||
/*dtsFileContents*/ "declare const x: string;",
|
||||
/*tsFileContents*/ "var y = 1;",
|
||||
/*opts*/ { experimentalDecorators: true, emitDecoratorMetadata: true },
|
||||
/*expectDTSEmit*/ true
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserverProjectSystem emit with outFile or out setting", () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user