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

support syntax highlighting for code documentation comments #75181

Open
1 of 3 tasks
Meir017 opened this issue Sep 20, 2024 · 5 comments
Open
1 of 3 tasks

support syntax highlighting for code documentation comments #75181

Meir017 opened this issue Sep 20, 2024 · 5 comments
Labels
Area-IDE Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality LSP issues related to the roslyn language server protocol implementation untriaged Issues and PRs which have not yet been triaged by a lead VSCode

Comments

@Meir017
Copy link
Contributor

Meir017 commented Sep 20, 2024

Summary

In many libraries authors add code sample inside the <code> documentation comment, it would be helpful to have syntax highlighting for these code comments

Background and Motivation

This type of syntax-highlighting already exists in the form of adding a // lang=C#-test or annotation an argument with [StringSyntax("C#-test")]

however, this doesn't work

// lang=C#-test
var code = """
using System;
using System.Text;
var builder = new StringBuilder();
test.AppendLine(""Hello, World!"");
Console.WriteLine(builder.ToString());
""";

/// <code lang="C#-test">
/// using System;
/// using System.Text;
/// var builder = new StringBuilder();
/// test.AppendLine("Hello, World!");
/// Console.WriteLine(builder.ToString());
/// </code>
void Test() { }

from vscode:
image

tasks from this issues:

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Sep 20, 2024
@sharwell sharwell added LSP issues related to the roslyn language server protocol implementation VSCode Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality and removed Feature Request labels Sep 24, 2024
@sharwell
Copy link
Member

Changing from Feature Request to Design Debt, since this feature was originally implemented in #35667 and the more recent LSP work failed to meet parity.

@CyrusNajmabadi
Copy link
Member

@sharwell we added support for c# syntax highlighting within a doc comment codeblock in VS?

@sharwell
Copy link
Member

@CyrusNajmabadi Sorry, I added the above comment after seeing #75215. There are two separate reports here: a request for syntax highlighting, and an observation that the comment renders as inline text instead of a code block. The part implemented previously is just the code block portion.

@JakeYallop
Copy link
Contributor

JakeYallop commented Sep 27, 2024

The impression I have is that the C#-test option is not really a public feature (hence the slightly awkward name) - although the fact is it used by people (including myself in projects) maybe demonstrates that properly exposing such functionality would be a good idea.

If this was going to be exposed, wouldn't it be better to expose it as just C#? The reason its C#-test currently is because it has support for the test markup syntax used for unit testing analyzers:

image

And people (like me) just use it as a stand in even outside of analzyer tests as there is no better option.

@Meir017
Copy link
Contributor Author

Meir017 commented Sep 27, 2024

I added tasks to the main comment here including the different requests we have here, I think that while discussing having syntax highlighting inside <code> comment tags it would make sense to even have intellisense (as if the code was inside this project)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Concept-Design Debt Engineering Debt, Design Debt, or poor product code quality LSP issues related to the roslyn language server protocol implementation untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

No branches or pull requests

4 participants