Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #74 from jaredpar/fix-73
Browse files Browse the repository at this point in the history
Don't save changed parse options
  • Loading branch information
jaredpar committed Feb 22, 2015
2 parents 3fd4df0 + 3e0ea5b commit 35fbbe4
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private async Task FormatAsync(Workspace workspace, IReadOnlyList<DocumentId> do
FormatLogger.WriteLine("Total time {0}", watch.Elapsed);
}

internal Solution AddTablePreprocessorSymbol(Solution solution)
private Solution AddTablePreprocessorSymbol(Solution solution)
{
var projectIds = solution.ProjectIds;
foreach (var projectId in projectIds)
Expand All @@ -122,13 +122,32 @@ internal Solution AddTablePreprocessorSymbol(Solution solution)
return solution;
}

/// <summary>
/// Remove the added table preprocessor symbol. Don't want that saved into the project
/// file as a change.
/// </summary>
private Solution RemoveTablePreprocessorSymbol(Solution newSolution, Solution oldSolution)
{
var solution = newSolution;
var projectIds = solution.ProjectIds;
foreach (var projectId in projectIds)
{
var oldProject = oldSolution.GetProject(projectId);
var newProject = newSolution.GetProject(projectId);
solution = newProject.WithParseOptions(oldProject.ParseOptions).Solution;
}

return solution;
}

internal async Task<Solution> FormatCoreAsync(Solution originalSolution, IReadOnlyList<DocumentId> documentIds, CancellationToken cancellationToken)
{
var solution = originalSolution;
solution = AddTablePreprocessorSymbol(originalSolution);
solution = await RunSyntaxPass(solution, documentIds, cancellationToken);
solution = await RunLocalSemanticPass(solution, documentIds, cancellationToken);
solution = await RunGlobalSemanticPass(solution, documentIds, cancellationToken);
solution = RemoveTablePreprocessorSymbol(solution, originalSolution);
return solution;
}

Expand Down

0 comments on commit 35fbbe4

Please sign in to comment.