Skip to content

Commit

Permalink
Specify SaveOptions in server capabilities
Browse files Browse the repository at this point in the history
`textDocument/didSave` is specified by the server capability of
SaveOptions or bool in the TextDocumentSyncOptions. Since this wasn't
getting set, some clients may not send `textDocument/didSave` since the
server never broadcasted this capability.

`includeText` is set to `false` since I didn't see anywhere we use the
text contents when responding to this method.

I've confirmed this fixes a bug in the client `helix` as dub build lints
weren't getting triggered since it wouldn't send the
`textDocument/didSave` message unless this capability was sent.
  • Loading branch information
tarkah authored and WebFreak001 committed Jun 2, 2023
1 parent ce3d7f4 commit 94f0291
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion source/served/extension.d
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,13 @@ InitializeResult initialize(InitializeParams params)
}

InitializeResult result;
SaveOptions save = {
includeText: false,
};
TextDocumentSyncOptions textDocumentSync = {
change: documents.syncKind,
save: save,
};
CompletionOptions completionProvider = {
resolveProvider: doCompleteSnippets,
triggerCharacters: [
Expand All @@ -285,7 +292,7 @@ InitializeResult initialize(InitializeParams params)
};
FoldingRangeOptions foldingRangeProvider;
ServerCapabilities serverCapabilities = {
textDocumentSync: documents.syncKind,
textDocumentSync: textDocumentSync,
// only provide fixes when doCompleteSnippets is requested
completionProvider: completionProvider,
referencesProvider: true,
Expand Down

0 comments on commit 94f0291

Please sign in to comment.