Skip to content

Commit

Permalink
Merge pull request #491 from krassowski/fix-sendSaved
Browse files Browse the repository at this point in the history
Fix Julia language server crashes on too broad save notification
  • Loading branch information
krassowski authored Jan 24, 2021
2 parents 5bf7584 + 6bbeb52 commit 864efd3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

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

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

Expand All @@ -20,6 +21,7 @@

[#485]: https://github.com/krassowski/jupyterlab-lsp/pull/485
[#487]: https://github.com/krassowski/jupyterlab-lsp/pull/487
[#491]: https://github.com/krassowski/jupyterlab-lsp/pull/491

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

Expand Down
22 changes: 19 additions & 3 deletions packages/jupyterlab-lsp/src/adapters/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,26 @@ export abstract class WidgetAdapter<T extends IDocumentWidget> {
}

if (state === 'completed') {
for (let connection of this.connection_manager.connections.values()) {
connection.sendSaved(
this.virtual_editor.virtual_document.document_info
// note: must only be send to the appropriate connections as
// some servers (Julia) break if they receive save notification
// for a document that was not opened before, see:
// https://github.com/krassowski/jupyterlab-lsp/issues/490
const documents_to_save = [this.virtual_editor.virtual_document];

for (let virtual_document of documents_to_save) {
let connection = this.connection_manager.connections.get(
virtual_document.uri
);
this.console.log(
'Sending save notification for',
virtual_document.uri,
'to',
connection
);
connection.sendSaved(virtual_document.document_info);
for (let foreign of virtual_document.foreign_documents.values()) {
documents_to_save.push(foreign);
}
}
}
}
Expand Down

0 comments on commit 864efd3

Please sign in to comment.