Skip to content

Commit cfcbfae

Browse files
committed
test(fmt): pin advertised LSP text document sync capability
1 parent 69fcea7 commit cfcbfae

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

packages/rstack/src/fmt/lsp/server.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,9 @@ const startFmtLsp = (options: RunFmtLspOptions, onExit: () => void): void => {
229229

230230
return {
231231
// The project config is the single source of truth, so client formatting
232-
// options are ignored and no other capability is advertised.
232+
// options are ignored. The connection fills in incremental
233+
// `textDocumentSync` for the `TextDocuments` listener; nothing else is
234+
// advertised.
233235
capabilities: { documentFormattingProvider: true },
234236
};
235237
});

packages/rstack/tests/cli/fmt/lsp.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ test(
4848
const { capabilities } = await client.initialize();
4949

5050
expect(capabilities.documentFormattingProvider).toBe(true);
51+
// Incremental sync, filled in by the connection for the `TextDocuments`
52+
// listener; without it compliant clients would never send the document.
53+
expect(capabilities.textDocumentSync).toBe(2);
5154
expect(capabilities.documentRangeFormattingProvider).toBeUndefined();
5255
expect(capabilities.documentOnTypeFormattingProvider).toBeUndefined();
5356
});

0 commit comments

Comments
 (0)