Skip to content

add base list before trailing trivia#2760

Merged
mattwar merged 3 commits intodotnet:masterfrom
mattwar:Bug293
May 15, 2015
Merged

add base list before trailing trivia#2760
mattwar merged 3 commits intodotnet:masterfrom
mattwar:Bug293

Conversation

@mattwar
Copy link
Contributor

@mattwar mattwar commented May 14, 2015

Fixes #293

This turned out not to be a formatter problem specifically, but one of a class of problems that plague manipulation of existing trees. The formatter had no indentation rule for base lists, but the real problem was that the SyntaxGenerator did not take into account existing trivia before adding the base list. The typical case when adding base list to existing class declaration is to have at least EOL trivia after the identifier (if following the default formatter style), and that EOL still existed after adding the base list to the class declaration, forcing the base list down the next line.

The fix is to insert the base list before the trailing trivia on the line, and then let the formatter have it.

@Pilchie @srivatsn please review

@Pilchie
Copy link
Member

Pilchie commented May 14, 2015

@dotnet-bot test this please

@mattwar
Copy link
Contributor Author

mattwar commented May 15, 2015

@Pilchie @srivatsn please review

@srivatsn
Copy link
Contributor

👍

mattwar added a commit that referenced this pull request May 15, 2015
add base list before trailing trivia
@mattwar mattwar merged commit 723dea4 into dotnet:master May 15, 2015
@mattwar mattwar deleted the Bug293 branch August 29, 2016 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Formatter doesn't indent a baselist with elastic trivia.

4 participants