@@ -2,6 +2,7 @@ import type { Disposable, Event, TextDocumentContentProvider } from 'vscode';
22import { EventEmitter , Uri , workspace } from 'vscode' ;
33import { Schemes } from '../constants' ;
44import type { GlCommands } from '../constants.commands' ;
5+ import type { Container } from '../container' ;
56import { decodeGitLensRevisionUriAuthority , encodeGitLensRevisionUriAuthority } from '../git/gitUri.authority' ;
67
78// gitlens-markdown:{explain}/{entity}/{entityID}/{model}[{/friendlyName}].md
@@ -29,7 +30,7 @@ export class MarkdownContentProvider implements TextDocumentContentProvider {
2930 return this . _onDidChange . event ;
3031 }
3132
32- constructor ( ) {
33+ constructor ( private container : Container ) {
3334 this . registration = workspace . registerTextDocumentContentProvider ( Schemes . GitLensMarkdown , this ) ;
3435
3536 workspace . onDidCloseTextDocument ( document => {
@@ -43,7 +44,7 @@ export class MarkdownContentProvider implements TextDocumentContentProvider {
4344 let contents = this . contents . get ( uri . toString ( ) ) ;
4445 if ( contents != null ) return contents ;
4546
46- contents = getContentFromMarkdownUri ( uri ) ;
47+ contents = getContentFromMarkdownUri ( uri , this . container . telemetry . enabled ) ;
4748 if ( contents != null ) return contents ;
4849
4950 return `# ${ uri . path } \n\nNo content available.` ;
@@ -87,7 +88,7 @@ export class MarkdownContentProvider implements TextDocumentContentProvider {
8788 }
8889}
8990
90- function getContentFromMarkdownUri ( uri : Uri ) : string | undefined {
91+ function getContentFromMarkdownUri ( uri : Uri , telemetryEnabled : boolean ) : string | undefined {
9192 if ( ! uri . path . startsWith ( '/explain' ) ) return undefined ;
9293
9394 const authority = uri . authority ;
@@ -97,7 +98,7 @@ function getContentFromMarkdownUri(uri: Uri): string | undefined {
9798
9899 if ( metadata . header == null ) return undefined ;
99100
100- const headerContent = getMarkdownHeaderContent ( metadata ) ;
101+ const headerContent = getMarkdownHeaderContent ( metadata , telemetryEnabled ) ;
101102
102103 if ( metadata . command == null ) return `${ headerContent } \n\nNo content available.` ;
103104
@@ -106,11 +107,19 @@ function getContentFromMarkdownUri(uri: Uri): string | undefined {
106107 return `${ headerContent } \n\n${ commandContent } ` ;
107108}
108109
109- export function getMarkdownHeaderContent ( metadata : MarkdownContentMetadata ) : string {
110+ export function getMarkdownHeaderContent ( metadata : MarkdownContentMetadata , telemetryEnabled : boolean ) : string {
110111 let headerContent = `# ${ metadata . header . title } ` ;
111112 if ( metadata . header . aiModel != null ) {
112113 headerContent += `\n\n> Generated by ${ metadata . header . aiModel } ` ;
113114 }
115+
116+ // Add feedback note if context is provided and telemetry is enabled
117+ if ( metadata . feedbackContext != null && telemetryEnabled ) {
118+ headerContent += '\n\n' ;
119+ headerContent += 'Use the 👍 and 👎 buttons in the editor toolbar to provide feedback on this AI response. ' ;
120+ headerContent += '*Your feedback helps us improve our AI features.*' ;
121+ }
122+
114123 if ( metadata . header . subtitle != null ) {
115124 headerContent += `\n\n## ${ metadata . header . subtitle } ` ;
116125 }
0 commit comments