Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 2b68b48

Browse files
tomv564felixfbecker
authored andcommitted
fix(streaming): don't send patches if client doesn't support streaming (#334)
1 parent 8a04861 commit 2b68b48

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/connection.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -251,17 +251,18 @@ export function registerLanguageHandler(messageEmitter: MessageEmitter, messageW
251251
if (isRequestMessage(message)) {
252252
const subscription = observable
253253
.do(patch => {
254-
span.log({ event: 'partialResult', patch });
255-
// Send $/partialResult for partial result patches
256-
// TODO only send if client supports it
257-
messageWriter.write({
258-
jsonrpc: '2.0',
259-
method: '$/partialResult',
260-
params: {
261-
id: message.id,
262-
patch: [patch]
263-
} as PartialResultParams
264-
});
254+
if (streaming) {
255+
span.log({ event: 'partialResult', patch });
256+
// Send $/partialResult for partial result patches only if client supports it
257+
messageWriter.write({
258+
jsonrpc: '2.0',
259+
method: '$/partialResult',
260+
params: {
261+
id: message.id,
262+
patch: [patch]
263+
} as PartialResultParams
264+
});
265+
}
265266
})
266267
// Build up final result for BC
267268
// TODO send null if client declared streaming capability

0 commit comments

Comments
 (0)