From b05706a93d7d22a5fa8dbde8905c72c5e7787b87 Mon Sep 17 00:00:00 2001 From: Zhiming Ma Date: Thu, 14 Nov 2024 12:39:00 +0800 Subject: [PATCH] fix(intellij): add try-catch for inline completion request. (#3416) --- .../intellijtabby/completion/InlineCompletionService.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/completion/InlineCompletionService.kt b/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/completion/InlineCompletionService.kt index d639bd787a36..99ee5ef8f9a9 100644 --- a/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/completion/InlineCompletionService.kt +++ b/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/completion/InlineCompletionService.kt @@ -233,7 +233,12 @@ class InlineCompletionService(private val project: Project) : Disposable { val server = getServer() ?: return@launch logger.debug("Request inline completion: $params") project.safeSyncPublisher(Listener.TOPIC)?.loadingStateChanged(true) - val inlineCompletionList = server.textDocumentFeature.inlineCompletion(params).await() + val inlineCompletionList = try { + server.textDocumentFeature.inlineCompletion(params).await() + } catch (e: Exception) { + logger.warn("Error while requesting inline completion", e) + null + } val context = current if (requestContext == context?.request) { logger.debug("Request inline completion done: $inlineCompletionList")