@@ -10,12 +10,22 @@ import { getUriPath } from '../../razor/src/uriPaths';
10
10
import { virtualHtmlSuffix } from '../../razor/src/razorConventions' ;
11
11
import { HtmlDocumentContentProvider } from './htmlDocumentContentProvider' ;
12
12
import { HtmlDocument } from './htmlDocument' ;
13
+ import { RoslynLanguageServer } from '../server/roslynLanguageServer' ;
14
+ import { RequestType , TextDocumentIdentifier } from 'vscode-languageserver-protocol' ;
13
15
14
16
export class HtmlDocumentManager {
15
17
private readonly htmlDocuments : { [ hostDocumentPath : string ] : HtmlDocument } = { } ;
16
18
private readonly contentProvider : HtmlDocumentContentProvider ;
17
19
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
+ ) {
19
29
this . contentProvider = new HtmlDocumentContentProvider ( this , this . logger ) ;
20
30
}
21
31
@@ -37,7 +47,13 @@ export class HtmlDocumentManager {
37
47
38
48
await this . closeDocument ( document . uri ) ;
39
49
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
+ ) ;
41
57
}
42
58
} ) ;
43
59
0 commit comments