@@ -10,12 +10,22 @@ import { getUriPath } from '../../razor/src/uriPaths';
1010import { virtualHtmlSuffix } from '../../razor/src/razorConventions' ;
1111import { HtmlDocumentContentProvider } from './htmlDocumentContentProvider' ;
1212import { HtmlDocument } from './htmlDocument' ;
13+ import { RoslynLanguageServer } from '../server/roslynLanguageServer' ;
14+ import { RequestType , TextDocumentIdentifier } from 'vscode-languageserver-protocol' ;
1315
1416export class HtmlDocumentManager {
1517 private readonly htmlDocuments : { [ hostDocumentPath : string ] : HtmlDocument } = { } ;
1618 private readonly contentProvider : HtmlDocumentContentProvider ;
1719
18- constructor ( private readonly platformInfo : PlatformInformation , private readonly logger : RazorLogger ) {
20+ private readonly razorDocumentClosedRequest : RequestType < TextDocumentIdentifier , void , Error > = new RequestType (
21+ 'razor/documentClosed'
22+ ) ;
23+
24+ constructor (
25+ private readonly platformInfo : PlatformInformation ,
26+ private readonly roslynLanguageServer : RoslynLanguageServer ,
27+ private readonly logger : RazorLogger
28+ ) {
1929 this . contentProvider = new HtmlDocumentContentProvider ( this , this . logger ) ;
2030 }
2131
@@ -37,7 +47,13 @@ export class HtmlDocumentManager {
3747
3848 await this . closeDocument ( document . uri ) ;
3949
40- // TODO: Send a notification back to the server so it can cancel any pending sync requests and clear its cache.
50+ // We don't care about the response, but Razor cohosting can't currently do notifications with documents
51+ // so making it a request means the logs end up in the right place.
52+ await this . roslynLanguageServer . sendRequest (
53+ this . razorDocumentClosedRequest ,
54+ TextDocumentIdentifier . create ( getUriPath ( document . uri ) ) ,
55+ new vscode . CancellationTokenSource ( ) . token
56+ ) ;
4157 }
4258 } ) ;
4359
0 commit comments