mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 14:21:53 +00:00
Fix LSP show message macro to allow format args (#15487)
## Summary This PR fixes the `show_*_msg` macros to pass all the tokens instead of just a single token. This allows for using various expressions right in the macro similar to how it would be in `format_args!`. ## Test Plan `cargo clippy`
This commit is contained in:
parent
18d5dbfb7f
commit
6aef4ad008
3 changed files with 10 additions and 11 deletions
|
@ -40,15 +40,15 @@ pub(super) fn try_show_message(
|
|||
/// Sends a request to display an error to the client with a formatted message. The error is sent
|
||||
/// in a `window/showMessage` notification.
|
||||
macro_rules! show_err_msg {
|
||||
($msg:expr$(, $($arg:tt),*)?) => {
|
||||
crate::message::show_message(::core::format_args!($msg, $($($arg),*)?).to_string(), lsp_types::MessageType::ERROR)
|
||||
($msg:expr$(, $($arg:tt)*)?) => {
|
||||
crate::message::show_message(::core::format_args!($msg$(, $($arg)*)?).to_string(), lsp_types::MessageType::ERROR)
|
||||
};
|
||||
}
|
||||
|
||||
/// Sends a request to display a warning to the client with a formatted message. The warning is
|
||||
/// sent in a `window/showMessage` notification.
|
||||
macro_rules! show_warn_msg {
|
||||
($msg:expr$(, $($arg:tt),*)?) => {
|
||||
crate::message::show_message(::core::format_args!($msg, $($($arg),*)?).to_string(), lsp_types::MessageType::WARNING)
|
||||
($msg:expr$(, $($arg:tt)*)?) => {
|
||||
crate::message::show_message(::core::format_args!($msg$(, $($arg)*)?).to_string(), lsp_types::MessageType::WARNING)
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue