Skip to content

Commit a91163c

Browse files
committed
Handle exit notification message correctly
This patch removes the wrapper that checks whether the server have been requested to shut down for the exit notification message. This message should be handled directly as is, since otherwise we never reach the exit() call and the server stays alive in a useless state forever.
1 parent 626d97d commit a91163c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/languageserverinstance.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ function Base.run(server::LanguageServerInstance)
333333
msg_dispatcher[initialize_request_type] = request_wrapper(initialize_request, server)
334334
msg_dispatcher[initialized_notification_type] = request_wrapper(initialized_notification, server)
335335
msg_dispatcher[shutdown_request_type] = request_wrapper(shutdown_request, server)
336-
msg_dispatcher[exit_notification_type] = request_wrapper(exit_notification, server)
337336
msg_dispatcher[cancel_notification_type] = request_wrapper(cancel_notification, server)
338337
msg_dispatcher[setTrace_notification_type] = request_wrapper(setTrace_notification, server)
339338
msg_dispatcher[setTraceNotification_notification_type] = request_wrapper(setTraceNotification_notification, server)
@@ -353,6 +352,11 @@ function Base.run(server::LanguageServerInstance)
353352
msg_dispatcher[julia_getDocFromWord_request_type] = request_wrapper(julia_getDocFromWord_request, server)
354353
msg_dispatcher[textDocument_selectionRange_request_type] = request_wrapper(textDocument_selectionRange_request, server)
355354

355+
# The exit notification message should not be wrapped in request_wrapper (which checks
356+
# if the server have been requested to be shut down). Instead, this message needs to be
357+
# handled directly.
358+
msg_dispatcher[exit_notification_type] = (conn, params) -> exit_notification(params, server, conn)
359+
356360
@debug "starting main loop"
357361
@debug "Starting event listener loop at $(round(Int, time()))"
358362
while true

0 commit comments

Comments
 (0)