Merge pull request #20369 from minestarks/noemitcos

compileOnSaveAffectedFileList shouldn't return any files for noEmit projects
This commit is contained in:
Mine Starks 2017-12-01 11:33:02 -08:00 committed by GitHub
commit 973cb767c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View file

@ -304,6 +304,24 @@ namespace ts.projectSystem {
sendAffectedFileRequestAndCheckResult(session, moduleFile1FileListRequest, []);
});
it("should return empty array if noEmit is set", () => {
configFile = {
path: "/a/b/tsconfig.json",
content: `{
"compileOnSave": true,
"compilerOptions": {
"noEmit": true
}
}`
};
const host = createServerHost([moduleFile1, file1Consumer1, file1Consumer2, configFile, libFile]);
const typingsInstaller = createTestTypingsInstaller(host);
const session = createSession(host, typingsInstaller);
openFilesForSession([moduleFile1], session);
sendAffectedFileRequestAndCheckResult(session, moduleFile1FileListRequest, []);
});
it("should save when compileOnSave is enabled in base tsconfig.json", () => {
configFile = {
path: "/a/b/tsconfig.json",

View file

@ -1245,7 +1245,7 @@ namespace ts.server {
// if specified a project, we only return affected file list in this project
const projectsToSearch = args.projectFileName ? [this.projectService.findProject(args.projectFileName)] : info.containingProjects;
for (const project of projectsToSearch) {
if (project.compileOnSaveEnabled && project.languageServiceEnabled) {
if (project.compileOnSaveEnabled && project.languageServiceEnabled && !project.getCompilationSettings().noEmit) {
result.push({
projectFileName: project.getProjectName(),
fileNames: project.getCompileOnSaveAffectedFileList(info),