Skip to content

Commit 798fa47

Browse files
dhruvmanilaMichaReiser
authored andcommitted
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.
1 parent a4b7c4e commit 798fa47

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

crates/ruff_server/src/server/api/requests/execute_command.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,24 @@ impl super::RequestHandler for ExecuteCommand {
3838
impl super::SyncRequestHandler for ExecuteCommand {
3939
fn run(
4040
session: &mut Session,
41-
notifier: client::Notifier,
41+
_notifier: client::Notifier,
4242
requester: &mut client::Requester,
4343
params: types::ExecuteCommandParams,
4444
) -> server::Result<Option<serde_json::Value>> {
4545
let command = SupportedCommand::from_str(&params.command)
4646
.with_failure_code(ErrorCode::InvalidParams)?;
4747

4848
if command == SupportedCommand::Debug {
49+
// TODO: Currently we only use the first argument i.e., the first document that's
50+
// provided but we could expand this to consider all *open* documents.
4951
let argument: DebugCommandArgument = params.arguments.into_iter().next().map_or_else(
5052
|| Ok(DebugCommandArgument::default()),
5153
|value| serde_json::from_value(value).with_failure_code(ErrorCode::InvalidParams),
5254
)?;
53-
let output = debug_information(session, argument.text_document)
54-
.with_failure_code(ErrorCode::InternalError)?;
55-
notifier
56-
.notify::<types::notification::LogMessage>(types::LogMessageParams {
57-
message: output.clone(),
58-
typ: types::MessageType::INFO,
59-
})
60-
.with_failure_code(ErrorCode::InternalError)?;
61-
return Ok(Some(serde_json::Value::String(output)));
55+
return Ok(Some(serde_json::Value::String(
56+
debug_information(session, argument.text_document)
57+
.with_failure_code(ErrorCode::InternalError)?,
58+
)));
6259
}
6360

6461
// check if we can apply a workspace edit

0 commit comments

Comments
 (0)