Skip to content

Commit ab3a651

Browse files
authored
Fix document sync registrations on init (#181)
Fixes a bug in #168 where the server would send the wrong registration for didSave on Smithy files.
1 parent 6178d58 commit ab3a651

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/software/amazon/smithy/lsp/SmithyLanguageServer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ private void registerDocumentSynchronization() {
298298
changeBuildOpts.setDocumentSelector(buildDocumentSelector);
299299
var saveBuildOpts = new TextDocumentSaveRegistrationOptions();
300300
saveBuildOpts.setDocumentSelector(buildDocumentSelector);
301+
saveBuildOpts.setIncludeText(true);
301302

302303
client.registerCapability(new RegistrationParams(List.of(
303304
new Registration("SyncSmithyBuildFiles/Open", "textDocument/didOpen", openCloseBuildOpts),
@@ -320,12 +321,13 @@ private void registerDocumentSynchronization() {
320321
changeSmithyOpts.setDocumentSelector(smithyDocumentSelector);
321322
var saveSmithyOpts = new TextDocumentSaveRegistrationOptions();
322323
saveSmithyOpts.setDocumentSelector(smithyDocumentSelector);
324+
saveSmithyOpts.setIncludeText(true);
323325

324326
client.registerCapability(new RegistrationParams(List.of(
325327
new Registration("SyncSmithyFiles/Open", "textDocument/didOpen", openCloseSmithyOpts),
326328
new Registration("SyncSmithyFiles/Close", "textDocument/didClose", openCloseSmithyOpts),
327329
new Registration("SyncSmithyFiles/Change", "textDocument/didChange", changeSmithyOpts),
328-
new Registration("SyncSmithyFiles/Save", "textDocument/didSave", saveBuildOpts))));
330+
new Registration("SyncSmithyFiles/Save", "textDocument/didSave", saveSmithyOpts))));
329331
}
330332

331333
@Override

0 commit comments

Comments
 (0)