mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:26 +00:00
Server: Remove log notification for printDebugInformation
command (#16617)
## Summary For context, the initial implementation started out by sending a log notification to the client to include this information in the client channel. This is a bit ineffective because it doesn't allow the client to display this information in a more obvious way. In addition to that, it isn't obvious from a users perspective as to where the information is being printed unless they actually open the output channel. The change was to actually return this formatted string that contains the information and let the client handle how it should display this information. For example, in the Ruff VS Code extension we open a split window and show this information which is similar to what rust-analyzer does. The notification request was kept as a precaution in case there are users who are actually utilizing this way. If they exists, it should a minority as it requires the user to actually dive into the code to understand how to hook into this notification. With 0.10, we're removing the old way as it only clobbers the output channel with a long message. fixes: #16225 ## Test Plan Tested it out locally that the information is not being logged to the output channel of VS Code.
This commit is contained in:
parent
a4b7c4ef70
commit
798fa47c2e
1 changed files with 7 additions and 10 deletions
|
@ -38,7 +38,7 @@ impl super::RequestHandler for ExecuteCommand {
|
|||
impl super::SyncRequestHandler for ExecuteCommand {
|
||||
fn run(
|
||||
session: &mut Session,
|
||||
notifier: client::Notifier,
|
||||
_notifier: client::Notifier,
|
||||
requester: &mut client::Requester,
|
||||
params: types::ExecuteCommandParams,
|
||||
) -> server::Result<Option<serde_json::Value>> {
|
||||
|
@ -46,19 +46,16 @@ impl super::SyncRequestHandler for ExecuteCommand {
|
|||
.with_failure_code(ErrorCode::InvalidParams)?;
|
||||
|
||||
if command == SupportedCommand::Debug {
|
||||
// TODO: Currently we only use the first argument i.e., the first document that's
|
||||
// provided but we could expand this to consider all *open* documents.
|
||||
let argument: DebugCommandArgument = params.arguments.into_iter().next().map_or_else(
|
||||
|| Ok(DebugCommandArgument::default()),
|
||||
|value| serde_json::from_value(value).with_failure_code(ErrorCode::InvalidParams),
|
||||
)?;
|
||||
let output = debug_information(session, argument.text_document)
|
||||
.with_failure_code(ErrorCode::InternalError)?;
|
||||
notifier
|
||||
.notify::<types::notification::LogMessage>(types::LogMessageParams {
|
||||
message: output.clone(),
|
||||
typ: types::MessageType::INFO,
|
||||
})
|
||||
.with_failure_code(ErrorCode::InternalError)?;
|
||||
return Ok(Some(serde_json::Value::String(output)));
|
||||
return Ok(Some(serde_json::Value::String(
|
||||
debug_information(session, argument.text_document)
|
||||
.with_failure_code(ErrorCode::InternalError)?,
|
||||
)));
|
||||
}
|
||||
|
||||
// check if we can apply a workspace edit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue