Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@genlu
Copy link
Member

@genlu genlu commented Jan 16, 2021

Partially address #48058 by showing warning in signature help for symbol unavailable in one of the related documents.

We discussed about adding a warning icon, but it seems only text is supported in VS (see this). I tried to add a unicode char "⚠" in the description text (see screenshot below, not that this change is not included in this PR), however, it means the same char will show up in the description of completion items as well. Thoughts?

image

@genlu genlu added the Area-IDE label Jan 16, 2021
@genlu genlu requested a review from a team as a code owner January 16, 2021 00:58
@genlu
Copy link
Member Author

genlu commented Jan 21, 2021

Ping @CyrusNajmabadi for review. Thanks!

Copy link
Contributor

@allisonchou allisonchou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know much about the signature help area at all, but (as far as I can tell) this lgtm🎉

</Workspace>";

var expectedDescription = new SignatureHelpTestItem($"void C.Do(int x)", currentParameterIndex: 0);
var expectedDescription = new SignatureHelpTestItem($"void C.Do(int x)\r\n\r\n{string.Format(FeaturesResources._0_1, "Proj1", FeaturesResources.Available)}\r\n{string.Format(FeaturesResources._0_1, "Proj2", FeaturesResources.Not_Available)}\r\n\r\n{FeaturesResources.You_can_use_the_navigation_bar_to_switch_context}", currentParameterIndex: 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not totally sure about this, but should the text here read: "You can use the navigation bar to switch contexts" (i.e. with the plural form of context)? I could be wrong, plus I see this string wasn't even declared in this PR, so probably not a big deal.

As an aside, I think "navigation bar" as a term isn't very intuitive, but I don't know of a better alternative. For example, when I first heard the term "navigation bar" I had to ask someone on the team what it was, because even searching the term on a search engine didn't pull up relevant results. Although this is likely unrelated to this PR, and just a comment about improving documentation in general. 😆

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the text here read: "You can use the navigation bar to switch contexts" (i.e. with the plural form of context)?

My English is so broken so I will trust you on this :D
I can send up a follow up PR to fix this.

I think "navigation bar" as a term isn't very intuitive

It's the official name, and this is the first result for "navigation bar visual studio" returned by google as of now, so I will stick to it
https://docs.microsoft.com/en-us/visualstudio/ide/navigating-code?view=vs-2019

var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>();
var anonymousTypeDisplayService = document.GetRequiredLanguageService<IAnonymousTypeDisplayService>();
var documentationCommentFormatter = document.GetRequiredLanguageService<IDocumentationCommentFormattingService>();
var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(attribute.ArgumentList!);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit: Instead of using ! here and in other areas, would it potentially be more readable if Contract checks were used instead? It would also allow us to throw sooner if there's an issue. It's probably personal preference though, and I also don't know if there's a fundamental difference between the two approaches I'm missing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. I've been using ! mostly, guess I will be using Contract.ThrowIfNull going forward :)

class C
{{
public void M(object o) => false;
#if TFM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I have to ask what is probably a super basic question here, but what is "TFM" out of curiosity?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFM = target framework moniker

@allisonchou
Copy link
Contributor

it means the same char will show up in the description of completion items as well. Thoughts?

Also, this seems OK to me. 👍 I like the unicode char.

@genlu genlu merged commit b9025e4 into dotnet:master Feb 2, 2021
@ghost ghost added this to the Next milestone Feb 2, 2021
@genlu genlu deleted the SigHelpOverloadWarning branch February 2, 2021 20:45
sharwell added a commit to sharwell/roslyn that referenced this pull request Feb 15, 2021
This issue was introduced by dotnet#50552 and caused signature help to
misbehave while typing.
@RikkiGibson RikkiGibson modified the milestones: Next, 16.10.P1 Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants