-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Improve Hover markdown on 'await' keyword #70629
Conversation
@@ -844,40 +846,65 @@ public static LSP.MarkupContent GetDocumentationMarkupContent(ImmutableArray<Tag | |||
}; | |||
} | |||
|
|||
var builder = new StringBuilder(); | |||
var isInCodeBlock = false; | |||
using var markdownBuilder = new MarkdownContentBuilder(); |
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.
switched to a more manual builder so I can access the contents of lines
src/Features/LanguageServer/ProtocolUnitTests/Hover/HoverTests.cs
Outdated
Show resolved
Hide resolved
_linesBuilder = ArrayBuilder<string>.GetInstance(); | ||
} | ||
|
||
public void Append(string text) |
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.
Could text every contain embedded newlines?
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.
Ideally it wouldn't be called like that, but I'm also not sure how to enforce that.
src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.MarkdownContentBuilder.cs
Outdated
Show resolved
Hide resolved
What about "returns System.String"? It's |
/azp run roslyn-integration-CI |
Azure Pipelines successfully started running 1 pipeline(s). |
src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.MarkdownContentBuilder.cs
Outdated
Show resolved
Hide resolved
src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.MarkdownContentBuilder.cs
Outdated
Show resolved
Hide resolved
src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.MarkdownContentBuilder.cs
Outdated
Show resolved
Hide resolved
src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.MarkdownContentBuilder.cs
Outdated
Show resolved
Hide resolved
Let's open a request on htat as well :) |
TBH the very idea of specifying a language as a markdown parameter is agains the whole language server idea since it requires client to know what language it is and how to colorize it. It would be perfect if LSP protocol allowed arbitrary colorizations and structuring in hovers similar to VS's hover API (colorized text runs and so on), but considering the speed of LSP development (or its absence) this will probably be added only in a very distant future( |
Improve the appearance of hover on await with return by using an inline code fence.
Resolves dotnet/vscode-csharp#6577
This is not perfect - unfortunately VSCode / markdown doesn't allow us to specify a language name for inline code fences, so it is not colorized. The alternative is to modify this to be a code block on a new line, but that doesn't look great either. This approach seemed reasonable to me.
Now looks like