Skip to content

Commit 836fc57

Browse files
committed
Updat error message
1 parent 2de8313 commit 836fc57

File tree

1 file changed

+26
-28
lines changed
  • crates/ty_server/src/server

1 file changed

+26
-28
lines changed

crates/ty_server/src/server/api.rs

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ use crate::system::{AnySystemPath, url_to_any_system_path};
44
use anyhow::anyhow;
55
use lsp_server as server;
66
use lsp_server::RequestId;
7+
use lsp_types::notification;
78
use lsp_types::notification::Notification;
9+
use ruff_db::panic::PanicError;
810
use std::panic::UnwindSafe;
911

1012
mod diagnostics;
@@ -13,34 +15,30 @@ mod requests;
1315
mod traits;
1416

1517
use self::traits::{NotificationHandler, RequestHandler};
16-
use notifications as notification;
17-
use requests as request;
18-
use ruff_db::panic::PanicError;
19-
2018
use super::{Result, client::Responder, schedule::BackgroundSchedule};
2119

2220
pub(super) fn request<'a>(req: server::Request) -> Task<'a> {
2321
let id = req.id.clone();
2422

2523
match req.method.as_str() {
26-
request::DocumentDiagnosticRequestHandler::METHOD => background_request_task::<
27-
request::DocumentDiagnosticRequestHandler,
24+
requests::DocumentDiagnosticRequestHandler::METHOD => background_request_task::<
25+
requests::DocumentDiagnosticRequestHandler,
2826
>(
2927
req, BackgroundSchedule::Worker
3028
),
31-
request::GotoTypeDefinitionRequestHandler::METHOD => background_request_task::<
32-
request::GotoTypeDefinitionRequestHandler,
29+
requests::GotoTypeDefinitionRequestHandler::METHOD => background_request_task::<
30+
requests::GotoTypeDefinitionRequestHandler,
3331
>(
3432
req, BackgroundSchedule::Worker
3533
),
36-
request::HoverRequestHandler::METHOD => {
37-
background_request_task::<request::HoverRequestHandler>(req, BackgroundSchedule::Worker)
38-
}
39-
request::InlayHintRequestHandler::METHOD => background_request_task::<
40-
request::InlayHintRequestHandler,
34+
requests::HoverRequestHandler::METHOD => background_request_task::<
35+
requests::HoverRequestHandler,
36+
>(req, BackgroundSchedule::Worker),
37+
requests::InlayHintRequestHandler::METHOD => background_request_task::<
38+
requests::InlayHintRequestHandler,
4139
>(req, BackgroundSchedule::Worker),
42-
request::CompletionRequestHandler::METHOD => background_request_task::<
43-
request::CompletionRequestHandler,
40+
requests::CompletionRequestHandler::METHOD => background_request_task::<
41+
requests::CompletionRequestHandler,
4442
>(
4543
req, BackgroundSchedule::LatencySensitive
4644
),
@@ -66,23 +64,23 @@ pub(super) fn request<'a>(req: server::Request) -> Task<'a> {
6664

6765
pub(super) fn notification<'a>(notif: server::Notification) -> Task<'a> {
6866
match notif.method.as_str() {
69-
notification::DidCloseTextDocumentHandler::METHOD => {
70-
local_notification_task::<notification::DidCloseTextDocumentHandler>(notif)
67+
notifications::DidCloseTextDocumentHandler::METHOD => {
68+
local_notification_task::<notifications::DidCloseTextDocumentHandler>(notif)
7169
}
72-
notification::DidOpenTextDocumentHandler::METHOD => {
73-
local_notification_task::<notification::DidOpenTextDocumentHandler>(notif)
70+
notifications::DidOpenTextDocumentHandler::METHOD => {
71+
local_notification_task::<notifications::DidOpenTextDocumentHandler>(notif)
7472
}
75-
notification::DidChangeTextDocumentHandler::METHOD => {
76-
local_notification_task::<notification::DidChangeTextDocumentHandler>(notif)
73+
notifications::DidChangeTextDocumentHandler::METHOD => {
74+
local_notification_task::<notifications::DidChangeTextDocumentHandler>(notif)
7775
}
78-
notification::DidOpenNotebookHandler::METHOD => {
79-
local_notification_task::<notification::DidOpenNotebookHandler>(notif)
76+
notifications::DidOpenNotebookHandler::METHOD => {
77+
local_notification_task::<notifications::DidOpenNotebookHandler>(notif)
8078
}
81-
notification::DidCloseNotebookHandler::METHOD => {
82-
local_notification_task::<notification::DidCloseNotebookHandler>(notif)
79+
notifications::DidCloseNotebookHandler::METHOD => {
80+
local_notification_task::<notifications::DidCloseNotebookHandler>(notif)
8381
}
84-
notification::DidChangeWatchedFiles::METHOD => {
85-
local_notification_task::<notification::DidChangeWatchedFiles>(notif)
82+
notifications::DidChangeWatchedFiles::METHOD => {
83+
local_notification_task::<notifications::DidChangeWatchedFiles>(notif)
8684
}
8785
lsp_types::notification::SetTrace::METHOD => {
8886
tracing::trace!("Ignoring `setTrace` notification");
@@ -231,7 +229,7 @@ where
231229
Ok(result) => result,
232230
Err(panic) => {
233231
tracing::error!("An error occurred while running {id}: {panic}");
234-
show_err_msg!("ty encountered a problem. Check the logs for more details.");
232+
show_err_msg!("ty encountered a panic. Check the logs for more details.");
235233
return;
236234
}
237235
};

0 commit comments

Comments
 (0)