Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vb to cs trivia #518

Merged
merged 38 commits into from
Feb 11, 2020
Merged

Vb to cs trivia #518

merged 38 commits into from
Feb 11, 2020

Conversation

GrahamTheCoder
Copy link
Member

@GrahamTheCoder GrahamTheCoder commented Feb 5, 2020

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
Copy link
Contributor

Saibamen commented Mar 8, 2020

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