What is the best way to copy errors onto the clipboard? #6096
Unanswered
David-Else
asked this question in
Q&A
Replies: 3 comments 3 replies
-
You might be thinking of #3786 |
Beta Was this translation helpful? Give feedback.
2 replies
-
One way I do this is by using Alacrity's Vim mode. I go into the Vim mode and then copy the errors that way. Not ideal but it works. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Here's the way I did it:
error[E0004]: non-exhaustive patterns: `None` not covered
--> src/main.rs:2:11
|
2 | match x {
| ^ pattern `None` not covered
|
note: `Option<i32>` defined here
--> /private/tmp/rust-20230718-6150-1ao30c6/rustc-1.71.0-src/library/core/src/option.rs:563:1
::: /private/tmp/rust-20230718-6150-1ao30c6/rustc-1.71.0-src/library/core/src/option.rs:567:5
|
= note: not covered
= note: the matched value is of type `Option<i32>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
3 ~ Some(i) => Some(i + 1),
4 ~ None => todo!(),
|
For more information about this error, try `rustc --explain E0004`.
error: could not compile `non-exhaustive` (bin "non-exhaustive") due to previous error WezTerm's QuickSelectArgs feature can be used to select {
key = 's',
mods = 'CMD|SHIFT',
action = wezterm.action.QuickSelectArgs {
label = 'open url',
patterns = {
'https?://\\S+',
'^/[^/\r\n]+(?:/[^/\r\n]+)*:\\d+:\\d+',
'[^\\s]+\\.rs:\\d+:\\d+',
'rustc --explain E\\d+',
},
action = wezterm.action_callback(function(window, pane)
local selection = window:get_selection_text_for_pane(pane)
wezterm.log_info('opening: ' .. selection)
if startswith(selection, "http") then
wezterm.open_with(selection)
elseif startswith(selection, "rustc --explain") then
local action = wezterm.action{
SplitPane={
direction = 'Right',
command = {
args = {
'/bin/sh',
'-c',
'rustc --explain ' .. selection:match("(%S+)$") .. ' | mdcat -p',
},
},
};
};
window:perform_action(action, pane);
else
selection = "$EDITOR:" .. selection
return open_with_hx(window, pane, selection)
end
end),
},
}, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I often want to copy a Rust error into the clipboard to paste into ChatGPT to help with debugging. At the moment I need to manually highlight it using Kitty and copy. The main problem is the the error appears right on top of the code, so I am forced to copy useless blocks of code I need to edit out. Total waste of time. Is there some way to copy the error, or would this be a quick/easy PR to create? I remember it being discussed before but can't seem to find the discussion.
Beta Was this translation helpful? Give feedback.
All reactions