Skip to content

Commit 7f5bfe9

Browse files
authored
Merge pull request #1105 from julia-vscode/sp/incremental-sync
Re-enable incremental sync and sync checking
2 parents ddcbc1a + 329c866 commit 7f5bfe9

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/requests/init.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ function ServerCapabilities(client::ClientCapabilities)
44
ServerCapabilities(
55
TextDocumentSyncOptions(
66
true,
7-
TextDocumentSyncKinds.Full,
7+
TextDocumentSyncKinds.Incremental,
88
false,
99
false,
10-
SaveOptions(false)
10+
SaveOptions(true)
1111
),
1212
CompletionOptions(false, [".", "@", "\"", "^"], missing),
1313
true,

src/requests/textdocument.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,17 @@ function textDocument_didClose_notification(params::DidCloseTextDocumentParams,
4242
end
4343

4444
function textDocument_didSave_notification(params::DidSaveTextDocumentParams, server::LanguageServerInstance, conn)
45+
uri = params.textDocument.uri
46+
doc = getdocument(server, uri)
47+
if params.text isa String
48+
if get_text(doc) != params.text
49+
JSONRPC.send(conn, window_showMessage_notification_type, ShowMessageParams(MessageTypes.Error, "Julia Extension: Please contact us! Your extension just crashed with a bug that we have been trying to replicate for a long time. You could help the development team a lot by contacting us at https://github.com/julia-vscode/julia-vscode so that we can work together to fix this issue."))
50+
throw(LSSyncMismatch("Mismatch between server and client text for $(get_uri(doc)). _open_in_editor is $(doc._open_in_editor). _workspace_file is $(doc._workspace_file). _version is $(get_version(doc))."))
51+
end
52+
end
53+
parse_all(doc, server)
4554
end
4655

47-
4856
function textDocument_willSave_notification(params::WillSaveTextDocumentParams, server::LanguageServerInstance, conn)
4957
end
5058

0 commit comments

Comments
 (0)