mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Avoid compile on save for declaration files
This commit is contained in:
parent
9243415ead
commit
5233bcc064
@ -1604,15 +1604,22 @@ namespace ts.server {
|
||||
path => this.projectService.getScriptInfoForPath(path)!,
|
||||
projects,
|
||||
(project, info) => {
|
||||
let result: protocol.CompileOnSaveAffectedFileListSingleProject | undefined;
|
||||
if (project.compileOnSaveEnabled && project.languageServiceEnabled && !project.isOrphan() && !project.getCompilationSettings().noEmit) {
|
||||
result = {
|
||||
projectFileName: project.getProjectName(),
|
||||
fileNames: project.getCompileOnSaveAffectedFileList(info),
|
||||
projectUsesOutFile: !!project.getCompilationSettings().outFile || !!project.getCompilationSettings().out
|
||||
};
|
||||
if (!project.compileOnSaveEnabled || !project.languageServiceEnabled || project.isOrphan()) {
|
||||
return undefined;
|
||||
}
|
||||
return result;
|
||||
|
||||
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
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
projectFileName: project.getProjectName(),
|
||||
fileNames: project.getCompileOnSaveAffectedFileList(info),
|
||||
projectUsesOutFile: !!compilationSettings.outFile || !!compilationSettings.out
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user