@@ -8,13 +8,14 @@ import { UriConverter } from '../../../lsptoolshost/utils/uriConverter';
88import { RazorDocumentManager } from '../document/razorDocumentManager' ;
99import { RazorLogger } from '../razorLogger' ;
1010import { ProvideDynamicFileParams } from './provideDynamicFileParams' ;
11- import { ProvideDynamicFileResponse , DynamicFileUpdate } from './provideDynamicFileResponse' ;
11+ import { ProvideDynamicFileResponse } from './provideDynamicFileResponse' ;
1212import { RemoveDynamicFileParams } from './removeDynamicFileParams' ;
1313import { CSharpProjectedDocument } from '../csharp/csharpProjectedDocument' ;
1414import { RazorDocumentChangeKind } from '../document/razorDocumentChangeKind' ;
1515import { RazorDynamicFileChangedParams } from './dynamicFileUpdatedParams' ;
1616import { TextDocumentIdentifier } from 'vscode-languageserver-protocol' ;
17- import { ServerTextChange } from '../rpc/serverTextChange' ;
17+ import { razorTextChange } from './razorTextChange' ;
18+ import { razorTextSpan } from './razorTextSpan' ;
1819
1920// Handles Razor generated doc communication between the Roslyn workspace and Razor.
2021// didChange behavior for Razor generated docs is handled in the RazorDocumentManager.
@@ -75,19 +76,11 @@ export class DynamicFileInfoHandler {
7576 if ( request . fullText ) {
7677 // The server asked for a full replace so the newtext is the important
7778 // thing here, the span doesn't matter.
78- const change : ServerTextChange = {
79- newText : razorDocument . csharpDocument . getContent ( ) ,
80- span : {
81- start : 0 ,
82- length : 0 ,
83- } ,
84- } ;
85-
86- const update = new DynamicFileUpdate ( [ change ] ) ;
79+ const change = new razorTextChange ( razorDocument . csharpDocument . getContent ( ) , new razorTextSpan ( 0 , 0 ) ) ;
8780
8881 return new ProvideDynamicFileResponse (
8982 request . razorDocument ,
90- [ update ] ,
83+ [ change ] ,
9184 csharpDocument . checksum ,
9285 csharpDocument . checksumAlgorithm ,
9386 csharpDocument . encodingCodePage
@@ -99,22 +92,18 @@ export class DynamicFileInfoHandler {
9992 if ( this . documentManager . isRazorDocumentOpenInCSharpWorkspace ( vscodeUri ) ) {
10093 // Open documents have didOpen/didChange to update the csharp buffer. Razor
10194 // does not send edits and instead lets vscode handle them.
102- return new ProvideDynamicFileResponse (
103- { uri : virtualCsharpUri } ,
104- null ,
105- csharpDocument . checksum ,
106- csharpDocument . checksumAlgorithm ,
107- csharpDocument . encodingCodePage
108- ) ;
95+ return null ;
10996 } else {
11097 // Closed documents provide edits since the last time they were requested since
11198 // there is no open buffer in vscode corresponding to the csharp content.
11299 const response = csharpDocument . applyEdits ( ) ;
113- const updates = response . edits ?. map ( ( e ) => new DynamicFileUpdate ( e . changes ) ) ?? null ;
100+ const updates = response . edits ?. flatMap ( ( e ) =>
101+ e . changes . map ( ( c ) => new razorTextChange ( c . newText , new razorTextSpan ( c . span . start , c . span . length ) ) )
102+ ) ;
114103
115104 return new ProvideDynamicFileResponse (
116105 { uri : virtualCsharpUri } ,
117- updates ,
106+ updates ?? [ ] ,
118107 response . originalChecksum ,
119108 response . originalChecksumAlgorithm ,
120109 response . originalEncodingCodePage
0 commit comments