-
Notifications
You must be signed in to change notification settings - Fork 420
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
Typelookup clean up and add objects for parameters and similar symbols #1062
Conversation
@DustinCampbell @rchande Do we want to remove the "Summary" and other tags from omnisharp-roslyn completely? More specifically from the DocumentationConverter.convertDocumentation as well ? |
I don't think so. That's still constructing the text for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking pretty good, couple of suggestions.
public string ReturnsText { get; } | ||
public string RemarksText { get; } | ||
public string ExampleText { get; } | ||
public string ValueText { get; } | ||
public string[ ] Exception { get; } | ||
public DocumentedObject[ ] Exception { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space
@@ -10,15 +10,15 @@ namespace OmniSharp.Models.TypeLookup | |||
public class DocumentationComment | |||
{ | |||
public string SummaryText { get; } | |||
public string[] TypeParamElements { get; } | |||
public string[] ParamElements { get; } | |||
public DocumentedObject[] TypeParamElements { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could just be Array<KeyValuePair<string, string>> or Array<Tuple<string, string>>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts @DustinCampbell ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what Newtownsoft.Json supports here. If we go with a custom type, I might call it DocumentationItem
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akshita31 : Note that Array is not a thing in C#. @rchande meant KeyValuePair<string, string>>[]
and Tuple<string, string>[]
. I would lean away from tuple because it would mean that the protocol would have weird names like Item1
and Item2
in it, which isn't what we want.
@@ -166,4 +159,25 @@ private static string GetCref(string cref) | |||
return cref + " "; | |||
} | |||
} | |||
|
|||
class DocumentedObjectHelper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DocumentedObjectBuilder?
public string Name { get; set; } | ||
public StringBuilder Documentation { get; set; } | ||
|
||
public DocumentedObjectHelper() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra spaces
Documentation = new StringBuilder(); | ||
} | ||
|
||
public DocumentedObject ConvertToDocumentedObject() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra spaces
{ | ||
public class DocumentedObject | ||
{ | ||
public string Name { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get rid of the public setters? This type should be immutable.
Name = Name, | ||
Documentation = Documentation.ToString() | ||
}; | ||
return documentedObject; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline after close brace of block when followed by non-brace.
@@ -140,7 +132,8 @@ public static DocumentationComment From(string xmlDocumentation, string lineEndi | |||
return null; | |||
} | |||
} | |||
return new DocumentationComment(summaryText.ToString(), typeParamElements.Select(s => s.ToString()).ToArray(), paramElements.Select(s => s.ToString()).ToArray(), returnsText.ToString(), remarksText.ToString(), exampleText.ToString(), valueText.ToString(), exception.Select(s => s.ToString()).ToArray()); | |||
|
|||
return new DocumentationComment(summaryText.ToString(), typeParamElements.Select(s => s.ConvertToDocumentedObject()).ToArray(), paramElements.Select(s => s.ConvertToDocumentedObject()).ToArray(), returnsText.ToString(), remarksText.ToString(), exampleText.ToString(), valueText.ToString(), exception.Select(s => s.ConvertToDocumentedObject()).ToArray()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put each argument on its own line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Issue : dotnet/vscode-csharp#1057
The fix removes unnecessary tags in the structured documentation.Also the Parameter, Exception and TypeParameters to objects having a name and documentation field. The tests have been modified accordingly.
Omnisharp-Vscode side : dotnet/vscode-csharp#1918