@@ -11,28 +11,36 @@ import { IRazorDocument } from '../document/IRazorDocument';
1111import { IRazorDocumentManager } from '../document/IRazorDocumentManager' ;
1212import { razorExtensionId } from '../razorExtensionId' ;
1313import { IReportIssueDataCollectionResult } from './IReportIssueDataCollectionResult' ;
14+ import { HtmlDocumentManager } from '../../../lsptoolshost/razor/htmlDocumentManager' ;
1415
1516export class ReportIssueCreator {
1617 constructor (
1718 private readonly vscodeApi : vscodeAdapter . api ,
18- private readonly documentManager : IRazorDocumentManager
19+ private readonly documentManager ?: IRazorDocumentManager ,
20+ private readonly cohostingDocumentManager ?: HtmlDocumentManager
1921 ) { }
2022
2123 public async create ( collectionResult : IReportIssueDataCollectionResult ) {
2224 let razorContent : string ;
2325 let csharpContent : string ;
2426 let htmlContent : string ;
2527
28+ razorContent = vscode . l10n . t ( 'Non Razor file as active document' ) ;
29+ csharpContent = vscode . l10n . t ( 'Could not determine CSharp content' ) ;
30+ htmlContent = vscode . l10n . t ( 'Could not determine Html content' ) ;
31+
2632 if ( collectionResult . document ) {
2733 razorContent = await this . getRazor ( collectionResult . document ) ;
2834
29- const razorDocument = await this . documentManager . getDocument ( collectionResult . document . uri ) ;
30- csharpContent = await this . getProjectedCSharp ( razorDocument ) ;
31- htmlContent = await this . getProjectedHtml ( razorDocument ) ;
32- } else {
33- razorContent = vscode . l10n . t ( 'Non Razor file as active document' ) ;
34- csharpContent = vscode . l10n . t ( 'Could not determine CSharp content' ) ;
35- htmlContent = vscode . l10n . t ( 'Could not determine Html content' ) ;
35+ if ( this . documentManager ) {
36+ const razorDocument = await this . documentManager . getDocument ( collectionResult . document . uri ) ;
37+ csharpContent = await this . getProjectedCSharp ( razorDocument ) ;
38+ htmlContent = await this . getProjectedHtml ( razorDocument ) ;
39+ } else if ( this . cohostingDocumentManager ) {
40+ const htmlDocument = await this . cohostingDocumentManager . getDocument ( collectionResult . document . uri ) ;
41+ csharpContent = vscode . l10n . t ( 'Cohosting is on, client has no access to CSharp content' ) ;
42+ htmlContent = htmlDocument . getContent ( ) ;
43+ }
3644 }
3745
3846 const razorExtensionVersion = this . getExtensionVersion ( ) ;
0 commit comments