Skip to content

Commit a33cfcb

Browse files
bors[bot]kjeremy
andauthored
Merge #4502
4502: Mark fixes from diagnostics as quick fixes r=kjeremy a=kjeremy Populates the diagnostic UI with fixes: Before: ![quickfix-before](https://user-images.githubusercontent.com/4325700/82165183-0e38df00-9882-11ea-96cf-7dab5faec4d4.PNG) After: ![image](https://user-images.githubusercontent.com/4325700/82165193-1a24a100-9882-11ea-97d7-be1b64b135e0.png) Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2 parents 1edf6d2 + 9e71fc0 commit a33cfcb

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

crates/rust-analyzer/src/main_loop/handlers.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,8 +730,13 @@ pub fn handle_code_action(
730730
for fix in fixes_from_diagnostics {
731731
let title = fix.label;
732732
let edit = to_proto::snippet_workspace_edit(&snap, fix.source_change)?;
733-
let action =
734-
lsp_ext::CodeAction { title, group: None, kind: None, edit: Some(edit), command: None };
733+
let action = lsp_ext::CodeAction {
734+
title,
735+
group: None,
736+
kind: Some(lsp_types::code_action_kind::QUICKFIX.into()),
737+
edit: Some(edit),
738+
command: None,
739+
};
735740
res.push(action);
736741
}
737742

crates/rust-analyzer/tests/heavy_tests/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ fn main() {}
298298
}
299299
]
300300
},
301+
"kind": "quickfix",
301302
"title": "Create module"
302303
}]),
303304
);
@@ -368,6 +369,7 @@ fn main() {{}}
368369
}
369370
]
370371
},
372+
"kind": "quickfix",
371373
"title": "Create module"
372374
}]),
373375
);

0 commit comments

Comments
 (0)