Skip to content

Commit

Permalink
Fix document sync registrations on init (#181)
Browse files Browse the repository at this point in the history
Fixes a bug in #168 where the server would send the wrong registration
for didSave on Smithy files.
  • Loading branch information
milesziemer authored Nov 6, 2024
1 parent 6178d58 commit ab3a651
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ private void registerDocumentSynchronization() {
changeBuildOpts.setDocumentSelector(buildDocumentSelector);
var saveBuildOpts = new TextDocumentSaveRegistrationOptions();
saveBuildOpts.setDocumentSelector(buildDocumentSelector);
saveBuildOpts.setIncludeText(true);

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

client.registerCapability(new RegistrationParams(List.of(
new Registration("SyncSmithyFiles/Open", "textDocument/didOpen", openCloseSmithyOpts),
new Registration("SyncSmithyFiles/Close", "textDocument/didClose", openCloseSmithyOpts),
new Registration("SyncSmithyFiles/Change", "textDocument/didChange", changeSmithyOpts),
new Registration("SyncSmithyFiles/Save", "textDocument/didSave", saveBuildOpts))));
new Registration("SyncSmithyFiles/Save", "textDocument/didSave", saveSmithyOpts))));
}

@Override
Expand Down

0 comments on commit ab3a651

Please sign in to comment.