55import { StaticFeature , FeatureState } from 'vscode-languageclient/lib/common/api'
66import { DidSaveTextDocumentNotification , DocumentSelector , Emitter , ServerCapabilities , TextDocumentSyncOptions } from 'vscode-languageserver-protocol'
77import * as vscode from 'vscode'
8- import { updateFile , willShutdownNotificationType , WillShutdownParams } from './customRequests'
8+ import { willShutdownNotificationType , WillShutdownParams } from './customRequests'
99import { Infrastructure } from './infrastructure'
10- import { LanguageClient , LanguageClientManager } from './languageClient'
10+ import { LanguageClientManager } from './languageClient'
1111import { getServices } from './services'
1212
1313interface ResolvedTextDocumentSyncCapabilities {
@@ -17,7 +17,7 @@ interface ResolvedTextDocumentSyncCapabilities {
1717// Initialize the file content into the lsp server for implementations that don't support open/close notifications
1818export class InitializeTextDocumentFeature implements StaticFeature {
1919 private didOpenTextDocumentDisposable : Disposable | undefined
20- constructor ( private languageClient : LanguageClient ) { }
20+ constructor ( private languageClient : LanguageClientManager , private infrastructure : Infrastructure ) { }
2121
2222 fillClientCapabilities ( ) : void { }
2323
@@ -27,10 +27,11 @@ export class InitializeTextDocumentFeature implements StaticFeature {
2727 return
2828 }
2929
30+ const infrastructure = this . infrastructure
3031 const languageClient = this . languageClient
3132 async function saveFile ( textDocument : vscode . TextDocument ) {
3233 if ( documentSelector != null && vscode . languages . match ( documentSelector , textDocument ) > 0 && textDocument . uri . scheme === 'file' ) {
33- await updateFile ( textDocument . uri . toString ( ) , textDocument . getText ( ) , languageClient )
34+ await infrastructure . saveFileContent ?. ( textDocument , vscode . TextDocumentSaveReason . Manual , languageClient )
3435
3536 // Always send notification even if the server doesn't support it (because csharp register the didSave feature too late)
3637 await languageClient . sendNotification ( DidSaveTextDocumentNotification . type , {
0 commit comments