Skip to content

Adopt editor InlinePromptService for documentation comments - #84282

Merged
akhera99 merged 11 commits into
dotnet:mainfrom
cdblake1:dev/calebblake/inlineprompt-doc-comment
Jul 29, 2026
Merged

Adopt editor InlinePromptService for documentation comments#84282
akhera99 merged 11 commits into
dotnet:mainfrom
cdblake1:dev/calebblake/inlineprompt-doc-comment

Conversation

@cdblake1

@cdblake1 cdblake1 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces the grey-text SuggestionService UX for Copilot documentation-comment generation with the editor's InlinePrompt chip. Typing /// above a member shows a Tab to generate documentation chip; accepting it generates the comment and writes it to the buffer.

CSharpGenDocComments

Changes

  • Remove the grey-text path (CopilotGenerateDocumentationCommentProvider, DocumentationCommentSuggestion, StartSuggestionSession).
  • Extract an editor-agnostic generation core into the Features layer (CopilotDocumentationCommentGenerator, DocumentationCommentEdit) shared by the chip-accept path.
  • Show the chip only when Copilot is available, the generate-documentation option is enabled, and the file is not Copilot-excluded.
  • Localize the chip accept text; move the provider id to a constant.
  • Add tests (InlinePrompt, ApplyEdits, generator) and editor package uptake to consume InlinePromptServiceBase.

Notes

  • The editor/VS package version bumps (eng/Packages.props, eng/Version.Details.xml, eng/Versions.props, src/Razor/Directory.Packages.props) are required to consume InlinePromptServiceBase from the editor.

@cdblake1
cdblake1 requested review from a team as code owners June 25, 2026 16:28
@dotnet-policy-service dotnet-policy-service Bot added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Jun 25, 2026
@cdblake1 cdblake1 changed the title Prototype: adopt editor InlinePromptService for doc comments [Demo Jun 25, 2026
@cdblake1 cdblake1 changed the title [Demo [WIP] Consuming InlinePromptService in CopilotGenerateDocumentation Jun 25, 2026
Replace the grey-text SuggestionService UX for Copilot documentation-comment
generation with the editor's InlinePrompt chip: typing `///` shows a
"Tab to generate documentation" chip, and accepting it generates the comment
and writes it to the buffer.

- Remove the grey-text path (CopilotGenerateDocumentationCommentProvider,
  DocumentationCommentSuggestion, StartSuggestionSession).
- Extract an editor-agnostic generation core into the Features layer
  (CopilotDocumentationCommentGenerator, DocumentationCommentEdit) shared by
  the chip-accept path.
- Show the chip only when Copilot is available, the generate-documentation
  option is enabled, and the file is not Copilot-excluded.
- Localize the chip accept text; move the provider id to a constant.
- Add tests (InlinePrompt, ApplyEdits, generator) and editor package uptake
  to consume InlinePromptServiceBase.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@cdblake1
cdblake1 force-pushed the dev/calebblake/inlineprompt-doc-comment branch from 9e367b4 to c496f25 Compare June 29, 2026 23:06
@cdblake1
cdblake1 marked this pull request as draft June 29, 2026 23:07
@cdblake1 cdblake1 changed the title [WIP] Consuming InlinePromptService in CopilotGenerateDocumentation Adopt editor InlinePromptService for documentation comments Jun 29, 2026
Comment thread eng/Packages.props Outdated
Comment thread src/EditorFeatures/Core/EditorFeaturesResources.resx
@cdblake1

cdblake1 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@cdblake1 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@dotnet-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@dotnet-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@dotnet-policy-service agree company="Microsoft"

Contributor License Agreement

@dotnet-policy-service agree company="Microsoft"

calebblake331 and others added 3 commits July 1, 2026 15:07
…prompt-doc-comment

# Conflicts:
#	eng/Packages.props
#	eng/Version.Details.props
#	src/EditorFeatures/TestUtilities/EditorTestCompositions.cs
@akhera99
akhera99 marked this pull request as ready for review July 14, 2026 16:20
@akhera99
akhera99 requested a review from a team as a code owner July 14, 2026 16:20
Copilot AI review requested due to automatic review settings July 14, 2026 16:20
@akhera99
akhera99 requested review from a team and removed request for a team July 14, 2026 16:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Copilot documentation-comment generation UX in the editor to use the InlinePrompt chip flow (instead of the prior grey-text suggestion flow), and factors generation/apply logic so it can be reused by the accept path. It also adds targeted unit tests and localizes the chip accept text.

Changes:

  • Switch documentation-comment generation UX to an InlinePrompt chip accept flow in CopilotGenerateDocumentationCommentManager.
  • Add a portable “edit” representation (DocumentationCommentEdit) and tests for generator + edit application + InlinePrompt behavior.
  • Localize the chip accept text and adjust editor test composition to run headless by exporting a no-op tooltip presenter factory.
Show a summary per file
File Description
src/Razor/Directory.Packages.props Updates VS/Copilot package versions referenced by Razor.
src/Features/CSharpTest/Copilot/CopilotDocumentationCommentGeneratorTests.cs Adds unit tests for proposal/edit generation mapping.
src/Features/Core/Portable/DocumentationComments/DocumentationCommentEdit.cs Introduces portable edit representation for applying generated doc updates.
src/Features/Core/Portable/DocumentationComments/CopilotDocumentationCommentGenerator.cs Refactors generation core to return portable edits.
src/EditorFeatures/TestUtilities/TestToolTipPresenterFactory.cs Adds a no-op tooltip presenter factory for headless test composition.
src/EditorFeatures/TestUtilities/EditorTestCompositions.cs Includes the new tooltip presenter factory in editor test composition.
src/EditorFeatures/CSharpTest/DocumentationComments/CopilotGenerateDocumentationInlinePromptTests.cs Adds WPF tests for InlinePrompt show/accept gating and edit application.
src/EditorFeatures/CSharpTest/DocumentationComments/CopilotGenerateDocumentationApplyEditsTests.cs Adds tests for translating/applying edits across snapshot versions.
src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf Adds localization entry for chip accept text.
src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf Adds localization entry for chip accept text.
src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf Adds localization entry for chip accept text.
src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf Adds localization entry for chip accept text.
src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf Adds localization entry for chip accept text.
src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf Adds localization entry for chip accept text.
src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf Adds localization entry for chip accept text.
src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf Adds localization entry for chip accept text.
src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf Adds localization entry for chip accept text.
src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf Adds localization entry for chip accept text.
src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf Adds localization entry for chip accept text.
src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf Adds localization entry for chip accept text.
src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf Adds localization entry for chip accept text.
src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj Suppresses InlinePrompt experimental warning at project level.
src/EditorFeatures/Core/EditorFeaturesResources.resx Adds localized resource string for chip accept text.
src/EditorFeatures/Core/DocumentationComments/DocumentationCommentSuggestion.cs Removes the old grey-text suggestion implementation.
src/EditorFeatures/Core/DocumentationComments/CopilotGenerateDocumentationCommentManager.cs Implements chip show/accept flow and applies generated edits to the buffer.
src/EditorFeatures/Core/DocumentationComments/AbstractDocumentationCommentCommandHandler.cs Removes pre-typing suggestion-session start hook; triggers proposal generation after snippet insertion.
eng/Versions.props Updates cryptography package version properties.
eng/Version.Details.xml Updates dependency versions tracked for the repo.
eng/Version.Details.props Updates Maestro-tracked dependency version properties.
eng/Packages.props Updates multiple VS/MSBuild package versions (editor uptake).

Copilot's findings

Comments suppressed due to low confidence (1)

src/EditorFeatures/Core/DocumentationComments/CopilotGenerateDocumentationCommentManager.cs:145

  • CopilotDocumentationCommentGenerator currently hard-codes C# doc-comment prefixes ("///") when wrapping/constructing multi-line edits (e.g. remarks insertion and line-wrapping). Since AbstractDocumentationCommentCommandHandler is shared by both C# and VB, this chip path can currently be offered in VB too, producing invalid doc comments ("///" inside VB doc comments). Until the generator is parameterized by exterior trivia, consider gating the feature to C# here.
    private static async Task<ICopilotCodeAnalysisService?> IsCopilotAvailableAsync(Document document, CancellationToken cancellationToken)
    {
        // Bailing out if copilot is not available or the option is not enabled.
        if (document.GetLanguageService<ICopilotOptionsService>() is not { } copilotOptionService ||
            !await copilotOptionService.IsGenerateDocumentationCommentOptionEnabledAsync().ConfigureAwait(false))
        {
            return null;
        }
  • Files reviewed: 30/30 changed files
  • Comments generated: 7

Comment thread eng/Version.Details.props
Comment thread eng/Version.Details.xml
Comment thread eng/Versions.props
Comment thread eng/Packages.props
Comment thread src/Razor/Directory.Packages.props
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
akhera99
akhera99 previously approved these changes Jul 15, 2026
Comment thread eng/Versions.props Outdated
<comment>The text surrounded by "[" and "]" characters will be hyperlinked. Please ensure the localized text still has "[" and "]" characters.</comment>
</data>
<data name="Generate_documentation" xml:space="preserve">
<value>generate documentation</value>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I saw this in the video clip as [TAB] generate documentation. Is all lowercase the desired design here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh you're right it should say "Tab to generate documentation"

@akhera99
akhera99 dismissed their stale review July 15, 2026 18:57

Removing as the UI is not what is expected

@akhera99
akhera99 merged commit ffd09ee into dotnet:main Jul 29, 2026
28 checks passed
@akhera99

Copy link
Copy Markdown
Member

/backport to release/insiders

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/insiders (link to workflow run)

@github-actions

Copy link
Copy Markdown
Contributor

@akhera99 backporting to release/insiders failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Adopt editor InlinePromptService for documentation comments
Using index info to reconstruct a base tree...
M	eng/Packages.props
M	eng/Version.Details.props
M	src/EditorFeatures/Core/EditorFeaturesResources.resx
M	src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj
M	src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf
M	src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf
M	src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf
M	src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf
M	src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf
M	src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf
M	src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf
M	src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf
M	src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf
M	src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf
M	src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf
M	src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf
M	src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf
M	src/EditorFeatures/TestUtilities/EditorTestCompositions.cs
Falling back to patching base and 3-way merge...
Auto-merging eng/Packages.props
CONFLICT (content): Merge conflict in eng/Packages.props
Auto-merging eng/Version.Details.props
CONFLICT (content): Merge conflict in eng/Version.Details.props
Auto-merging src/EditorFeatures/Core/EditorFeaturesResources.resx
Auto-merging src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj
Auto-merging src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf
Auto-merging src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf
Auto-merging src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf
Auto-merging src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf
Auto-merging src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf
Auto-merging src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf
Auto-merging src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf
Auto-merging src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf
Auto-merging src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf
Auto-merging src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf
Auto-merging src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf
Auto-merging src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf
Auto-merging src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf
Auto-merging src/EditorFeatures/TestUtilities/EditorTestCompositions.cs
CONFLICT (content): Merge conflict in src/EditorFeatures/TestUtilities/EditorTestCompositions.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Adopt editor InlinePromptService for documentation comments
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

akhera99 added a commit that referenced this pull request Jul 30, 2026
… comments (#84693)

Cherry-pick of #84282 

## Summary

Replaces the grey-text `SuggestionService` UX for Copilot
documentation-comment generation with the editor's **InlinePrompt**
chip. Typing `///` above a member shows a **Tab to generate
documentation** chip; accepting it generates the comment and writes it
to the buffer.

<img width="1014" height="366" alt="CSharpGenDocComments"
src="https://github.com/user-attachments/assets/e7265877-93ec-49f9-81fa-03cfb17b484a"
/>


## Changes

- Remove the grey-text path
(`CopilotGenerateDocumentationCommentProvider`,
`DocumentationCommentSuggestion`, `StartSuggestionSession`).
- Extract an editor-agnostic generation core into the Features layer
(`CopilotDocumentationCommentGenerator`, `DocumentationCommentEdit`)
shared by the chip-accept path.
- Show the chip only when Copilot is available, the
generate-documentation option is enabled, and the file is not
Copilot-excluded.
- Localize the chip accept text; move the provider id to a constant.
- Add tests (InlinePrompt, ApplyEdits, generator) and editor package
uptake to consume `InlinePromptServiceBase`.

## Notes

- The editor/VS package version bumps (`eng/Packages.props`,
`eng/Version.Details.xml`, `eng/Versions.props`,
`src/Razor/Directory.Packages.props`) are required to consume
`InlinePromptServiceBase` from the editor.

---------
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/roslyn/pull/84693)

---------

Co-authored-by: cdblake1 <cdblake31@gmail.com>
Co-authored-by: Caleb Blake <calebblake@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@jjonescz jjonescz added this to the 18.11 milestone Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Razor Community The pull request was submitted by a contributor who is not a Microsoft employee. VSCode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants