fix: use MarkupContent respecting client markdown capabilities for all LSP documentation fields#66
fix: use MarkupContent respecting client markdown capabilities for all LSP documentation fields#66
Conversation
…ields Co-authored-by: hientrung <6129457+hientrung@users.noreply.github.com>
…e-help docs Agent-Logs-Url: https://github.com/Catglobe/Catglobe.CgScript/sessions/4e6c924a-41d4-4086-8e0a-08ddd2b76b77 Co-authored-by: davhdavh <1201165+davhdavh@users.noreply.github.com>
Done in 6aa1ec0. Added two new capability flags read during
Added Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
davhdavh
left a comment
There was a problem hiding this comment.
@copilot The unittest just covers when the client says it can handle markdown... The point is that if it says plaintext only, it should get plaintext, and if it says both, it should get markdown... for ALL places where this is relevant.
And it should obviously look nice in both cases... e.g. double newline in markdown is a just a section/paragraph change, but in plaintext is a double newline...
…e types Agent-Logs-Url: https://github.com/Catglobe/Catglobe.CgScript/sessions/4210359a-2ea9-4df1-aa48-b5c089551573 Co-authored-by: davhdavh <1201165+davhdavh@users.noreply.github.com>
… doc helpers Co-authored-by: davhdavh <1201165+davhdavh@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
LSP clients were receiving plain strings or unconditional markdown for some
Documentationfields, causing markdown syntax to render as raw text on non-markdown clients, or markdown to be sent to clients that never declared support for it.Root causes
TopLevelCompletions):Documentation = obj.Docassigned a rawstring?directly — the only completion path not already usingMarkupContent.CgScriptLanguageTarget.Hover.cs):ParameterInformation.Documentationwas using the string variant ofSumType<string, MarkupContent>.MarkupKind.Markdownwithout checking whether the client declared markdown support, unlike the existingHoverContent()which already respectedhover.contentFormat.Changes
CgScriptLanguageTarget.cs: Two new capability flags read duringInitialize():_clientSupportsMarkdownCompletionfromcompletionItem.documentationFormat_clientSupportsMarkdownSignaturefromsignatureHelp.signatureInformation.documentationFormatCgScriptLanguageTarget.Hover.cs:StripMarkdown(string)static helper that removes inline code spans, bold, italic, and---separators, producing clean readable plain text in all cases.CompletionDoc(string)helper — returnsMarkupKind.Markdownwhen the client declares it, otherwise strips inline markdown and returnsMarkupKind.PlainText.SignatureDoc(string)helper — same pattern for signature-help documentation.SignatureInformationandParameterInformationdocs now useSignatureDoc(). Constructor docs include obsolete-deprecation prefixes.CgScriptLanguageTarget.Completion.cs: All completion itemDocumentationfields (methods, properties, functions, objects, enum constants) now useCompletionDoc(), including obsolete-deprecation prefixes where applicable.Before / After
Tests
CompletionObjectTests.cs: VerifiesPlainText(with stripped markdown) when no capability declared,Markdownwhen declared.DocumentationFormatTests.cs: Comprehensive coverage across all documentation-bearing response types — function completions (single-variant, multi-variant with---separator, "both" capability), member method completions, member property completions, and signature help for functions, methods, and constructors. Each scenario asserts both theKindand that the content is readable (no raw markdown syntax in plain-text output; markdown syntax preserved in markdown output).💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.