Skip to content

Commit 40b6a1e

Browse files
committed
fix(csharp): Always send didSave notification
1 parent f0c70b2 commit 40b6a1e

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

src/extensions.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,13 @@ export class InitializeTextDocumentFeature implements StaticFeature {
2828
if (Services.get().languages.match(documentSelector!, textDocument)) {
2929
await updateFile(textDocument.uri, textDocument.getText(), languageClient)
3030

31-
// send save notification if there is the capability
32-
if (
33-
textDocumentSyncOptions != null &&
34-
textDocumentSyncOptions.save != null &&
35-
(typeof textDocumentSyncOptions.save !== 'boolean' || textDocumentSyncOptions.save)
36-
) {
37-
const includeText: boolean = typeof textDocumentSyncOptions.save === 'boolean' ? false : (textDocumentSyncOptions.save.includeText ?? false)
38-
39-
languageClient.sendNotification(DidSaveTextDocumentNotification.type, {
40-
textDocument: {
41-
uri: textDocument.uri
42-
},
43-
text: includeText ? textDocument.getText() : undefined
44-
})
45-
}
31+
// Always send notification even if the server doesn't support it (because csharp register the didSave feature too late)
32+
languageClient.sendNotification(DidSaveTextDocumentNotification.type, {
33+
textDocument: {
34+
uri: textDocument.uri
35+
},
36+
text: textDocument.getText()
37+
})
4638
}
4739
}
4840

0 commit comments

Comments
 (0)