|
|
|
@ -467,12 +467,9 @@ pub fn code_action(cx: &mut Context) {
|
|
|
|
|
// while more situational commands (like refactors) show up later
|
|
|
|
|
// this behaviour is modeled after the behaviour of vscode (editor/contrib/codeAction/browser/codeActionWidget.ts)
|
|
|
|
|
|
|
|
|
|
let mut categories = vec![Vec::new(); 8];
|
|
|
|
|
for action in actions.drain(..) {
|
|
|
|
|
let category = match &action {
|
|
|
|
|
actions.sort_by_key(|action| match &action {
|
|
|
|
|
lsp::CodeActionOrCommand::CodeAction(lsp::CodeAction {
|
|
|
|
|
kind: Some(kind),
|
|
|
|
|
..
|
|
|
|
|
kind: Some(kind), ..
|
|
|
|
|
}) => {
|
|
|
|
|
let mut components = kind.as_str().split('.');
|
|
|
|
|
|
|
|
|
@ -491,14 +488,7 @@ pub fn code_action(cx: &mut Context) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_ => 7,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
categories[category].push(action);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for category in categories {
|
|
|
|
|
actions.extend(category.into_iter())
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let mut picker =
|
|
|
|
|
ui::Menu::new(actions, false, (), move |editor, code_action, event| {
|
|
|
|
|