Skip to content

Commit 864efd3

Browse files
authored
Merge pull request #491 from krassowski/fix-sendSaved
Fix Julia language server crashes on too broad save notification
2 parents 5bf7584 + 6bbeb52 commit 864efd3

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
- diagnostics panel works after kernel restart properly ([#485])
1313
- workaround was added to enable `jedi-language-server` diagnostics ([#485])
14+
- Julia language server will not crash when saving a non-Julia file: fixed sendSaved notification scope ([#491])
1415

1516
### `jupyter-lsp 1.1.1` (unreleased)
1617

@@ -20,6 +21,7 @@
2021

2122
[#485]: https://github.com/krassowski/jupyterlab-lsp/pull/485
2223
[#487]: https://github.com/krassowski/jupyterlab-lsp/pull/487
24+
[#491]: https://github.com/krassowski/jupyterlab-lsp/pull/491
2325

2426
### `@krassowski/jupyterlab-lsp 3.1.0` (2021-01-17)
2527

packages/jupyterlab-lsp/src/adapters/adapter.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,26 @@ export abstract class WidgetAdapter<T extends IDocumentWidget> {
259259
}
260260

261261
if (state === 'completed') {
262-
for (let connection of this.connection_manager.connections.values()) {
263-
connection.sendSaved(
264-
this.virtual_editor.virtual_document.document_info
262+
// note: must only be send to the appropriate connections as
263+
// some servers (Julia) break if they receive save notification
264+
// for a document that was not opened before, see:
265+
// https://github.com/krassowski/jupyterlab-lsp/issues/490
266+
const documents_to_save = [this.virtual_editor.virtual_document];
267+
268+
for (let virtual_document of documents_to_save) {
269+
let connection = this.connection_manager.connections.get(
270+
virtual_document.uri
265271
);
272+
this.console.log(
273+
'Sending save notification for',
274+
virtual_document.uri,
275+
'to',
276+
connection
277+
);
278+
connection.sendSaved(virtual_document.document_info);
279+
for (let foreign of virtual_document.foreign_documents.values()) {
280+
documents_to_save.push(foreign);
281+
}
266282
}
267283
}
268284
}

0 commit comments

Comments
 (0)