Skip to content

Vb to cs trivia - #518

Merged
GrahamTheCoder merged 38 commits into
masterfrom
vb-to-cs-trivia
Feb 11, 2020
Merged

GrahamTheCoder merged 38 commits into
masterfrom
vb-to-cs-trivia

Conversation

@GrahamTheCoder

@GrahamTheCoder GrahamTheCoder commented Feb 5, 2020 •

Copy link
Copy Markdown
Member

Fixes #506
Fixes #436

Problem

VB -> CS comment conversion can lose comments at the moment, and it's quite hard for a given testcase to get the comments back in the right place.

Solution

This PR moves over to using the LineTriviaMapper (newly written for CS -> VB comments but can be applied completely generally)

  • Enable the ordering tests equivalent to CS -> VB
  • Formatting of local functions seems to always use one line even when there are multiple statements

Future PR: Basic conversions for if directives and regions (Extend ConvertVBTrivia method)

Issues:
* StatementTests show comments that are lost (or sometimes moved upwards significantly
* Multi file tests show comment at top of class ending up at the end - see end of TestData\MultiFileCharacterization\VBToCSResults\ConvertWholeSolution\VbLibrary\My Project\MyNamespace.Static.Designer.cs
* method block doc comments end up on the class (or element) above where they come from
* Formatting of local functions seems to always use one line even when there are multiple statements
If this problem turns up a lot we could consider having the syntax tree to check against available in the visitor wrapper
System first, then alphabetically, preferring those that have source mappings
@GrahamTheCoder
GrahamTheCoder marked this pull request as ready for review February 11, 2020 01:07
@GrahamTheCoder
GrahamTheCoder merged commit 8d871e9 into master Feb 11, 2020
@GrahamTheCoder
GrahamTheCoder deleted the vb-to-cs-trivia branch February 11, 2020 01:17
@Saibamen

Saibamen commented Mar 8, 2020

Copy link
Copy Markdown
Contributor

Also fixes #436

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VB -> C#: Important comments are lost VB -> C#: withBlock semicolon not in right line

2 participants