-
Notifications
You must be signed in to change notification settings - Fork 676
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
Proper Newlines in Hover #1918
Proper Newlines in Hover #1918
Conversation
It looks like there's something wrong with your branch in that it's picking up several changes from @rchande |
@DustinCampbell That was intentional. We needed to make a few tweaks to make integration tests more reliable. |
Got it. |
src/features/hoverProvider.ts
Outdated
documentation += structDoc[val] + newline; | ||
} | ||
} | ||
); |
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 I'm sold on the property loop. This will cause the order of the tooltip to change if the properties are ever returned in a different order. Also, if any other element that becomes an array would get the heading "Exceptions:". Should we just check the properties we care about and construct the tooltip text in a deterministic way? E.g.
if (structDoc.SummaryText) {
documentation += structDoc.SummaryText;
}
if (structDoc.ParamElements && structDoc.ParamElements.length > 0)) {
documentation += "Parameters:" + newLine;
documentation += structDoc.ParamElements.join(newLine) + newLine;
}
etc...
@akshita31 : Could include a screenshot of the hover tooltip with your change? |
I suspect tests are going to fail because we haven't shipped a new Omnisharp into VS Code in a while. @DustinCampbell mind if I do that this week? (Likely tomorrow) |
@rchande: I have no problem with it. Check with the OmniSharp folks though. Somebody will need to go through and update the OmniSharp changelog for all of the merged changes since 1.28 as well. |
@rchande: We should make this a topic during the OmniSharp meeting tomorrow. |
@akshita31 : Do we want to include all of the tags in the hover tooltip? Visual Studio specifically doesn't do that. Also, it doesn't include a "Summary" heading or the "Returns". |
If we do want to include the parameters and other items like that, I'd recommend spending some time organizing the tooltip to look a bit better organized, rather than just putting a blank line in between everything. For example:
Also, note that there appears to be a bug in your screenshot where there is no space between "true" and "if". |
That looks like a classification bug for @DustinCampbell to discuss. |
@akshita31 : The "Summary" text is extra noise and a regression from previous behavior. Here's what it looks like today: IMO, none of the properties on StructuredDocumentation should include a heading. Parameters, type parameters and exceptions should probably be arrays of objects with "Name" and "Documentation" properties. The text should just be the documentation string. If the host wants to add a heading during display, that's fine, but it seems strange that omnisharp-roslyn would do it. @rchande: What do you think? |
@DustinCampbell I agree. Even if we wanted to present a heading, that's something that should be up to clients, not forced on them by OmniSharp. @akshita31 Can you help work on a change to Omnisharp that so we don't add "Summary" and so forth to the section text returned from OmniSharp? Sorry we didn't catch that during your code review! |
Yes, I'll do that. |
Also @DustinCampbell, should we wait for that change before we do the release we're planning this week? |
It wouldn't take long to make the tweak. I'd just submit the PR to omnisharp-roslyn and we'll take it. After all, we're still waiting on the three Cake PRs. |
And if we ship omnisharp-roslyn before the PR goes in, c'est la vie! I'm assuming that we'll be taking another omnisharp-roslyn before shipping omnisharp-vscode. |
@DustinCampbell By classification, I meant that it looks like adding "\t" to a string literal turns all the tokens blue (https://user-images.githubusercontent.com/12554141/33908867-9d98a40a-df3e-11e7-84fe-6302aca85a8d.png) from above. |
Oh yeah, that's weird. I wonder if VS Code's markdown grammar gets run over this. |
@rchande We need to publish omnisharp to the CDN in order to merge this. |
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.
Couple of tweaks otherwise lgtm
} | ||
|
||
if (structDoc.RemarksText) { | ||
documentation += structDoc.RemarksText + newLine; |
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.
Might be worth extracting out a little helper method that adds the newline for you.
src/features/hoverProvider.ts
Outdated
@@ -21,9 +21,11 @@ export default class OmniSharpHoverProvider extends AbstractSupport implements H | |||
|
|||
return serverUtils.typeLookup(this._server, req, token).then(value => { | |||
if (value && value.Type) { | |||
let contents = [extractSummaryText(value.Documentation), { language: 'csharp', value: value.Type }]; | |||
let structDoc = value.StructuredDocumentation; |
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.
structDoc unused?
@akshita31 That unused variable causing your Travis build to fail. |
Fixes : #1057
Added Code to allow VS Code to consume the "StructuredDocumentation" object returned by omnisharp-roslyn in typelookup and append newlines appropriately. Also added an integration test for the same.
Please review : @DustinCampbell @TheRealPiotrP @rchande
Omnisharp-roslyn side : OmniSharp/omnisharp-roslyn#1038