Revert actions! changes
This commit is contained in:
parent
b66b4915cf
commit
c97c9f98c0
15 changed files with 389 additions and 334 deletions
|
@ -6,7 +6,7 @@ use editor::{
|
|||
movement::{self, FindRange},
|
||||
Bias, CharKind, DisplayPoint,
|
||||
};
|
||||
use gpui::{actions, Action, AppContext, WindowContext};
|
||||
use gpui::{actions, impl_actions, Action, AppContext, ViewContext, WindowContext};
|
||||
use language::Selection;
|
||||
use serde::Deserialize;
|
||||
use workspace::Workspace;
|
||||
|
@ -27,43 +27,59 @@ pub enum Object {
|
|||
AngleBrackets,
|
||||
}
|
||||
|
||||
#[derive(Action, Clone, Deserialize, PartialEq)]
|
||||
#[derive(Clone, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct Word {
|
||||
#[serde(default)]
|
||||
ignore_punctuation: bool,
|
||||
}
|
||||
|
||||
impl_actions!(vim, [Word]);
|
||||
|
||||
actions!(
|
||||
Sentence,
|
||||
Quotes,
|
||||
BackQuotes,
|
||||
DoubleQuotes,
|
||||
VerticalBars,
|
||||
Parentheses,
|
||||
SquareBrackets,
|
||||
CurlyBrackets,
|
||||
AngleBrackets
|
||||
vim,
|
||||
[
|
||||
Sentence,
|
||||
Quotes,
|
||||
BackQuotes,
|
||||
DoubleQuotes,
|
||||
VerticalBars,
|
||||
Parentheses,
|
||||
SquareBrackets,
|
||||
CurlyBrackets,
|
||||
AngleBrackets
|
||||
]
|
||||
);
|
||||
|
||||
pub fn init(cx: &mut AppContext) {
|
||||
// todo!()
|
||||
// cx.add_action(
|
||||
// |_: &mut Workspace, &Word { ignore_punctuation }: &Word, cx: _| {
|
||||
// object(Object::Word { ignore_punctuation }, cx)
|
||||
// },
|
||||
// );
|
||||
// cx.add_action(|_: &mut Workspace, _: &Sentence, cx: _| object(Object::Sentence, cx));
|
||||
// cx.add_action(|_: &mut Workspace, _: &Quotes, cx: _| object(Object::Quotes, cx));
|
||||
// cx.add_action(|_: &mut Workspace, _: &BackQuotes, cx: _| object(Object::BackQuotes, cx));
|
||||
// cx.add_action(|_: &mut Workspace, _: &DoubleQuotes, cx: _| object(Object::DoubleQuotes, cx));
|
||||
// cx.add_action(|_: &mut Workspace, _: &Parentheses, cx: _| object(Object::Parentheses, cx));
|
||||
// cx.add_action(|_: &mut Workspace, _: &SquareBrackets, cx: _| {
|
||||
// object(Object::SquareBrackets, cx)
|
||||
// });
|
||||
// cx.add_action(|_: &mut Workspace, _: &CurlyBrackets, cx: _| object(Object::CurlyBrackets, cx));
|
||||
// cx.add_action(|_: &mut Workspace, _: &AngleBrackets, cx: _| object(Object::AngleBrackets, cx));
|
||||
// cx.add_action(|_: &mut Workspace, _: &VerticalBars, cx: _| object(Object::VerticalBars, cx));
|
||||
pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
|
||||
workspace.register_action(
|
||||
|_: &mut Workspace, &Word { ignore_punctuation }: &Word, cx: _| {
|
||||
object(Object::Word { ignore_punctuation }, cx)
|
||||
},
|
||||
);
|
||||
workspace
|
||||
.register_action(|_: &mut Workspace, _: &Sentence, cx: _| object(Object::Sentence, cx));
|
||||
workspace.register_action(|_: &mut Workspace, _: &Quotes, cx: _| object(Object::Quotes, cx));
|
||||
workspace
|
||||
.register_action(|_: &mut Workspace, _: &BackQuotes, cx: _| object(Object::BackQuotes, cx));
|
||||
workspace.register_action(|_: &mut Workspace, _: &DoubleQuotes, cx: _| {
|
||||
object(Object::DoubleQuotes, cx)
|
||||
});
|
||||
workspace.register_action(|_: &mut Workspace, _: &Parentheses, cx: _| {
|
||||
object(Object::Parentheses, cx)
|
||||
});
|
||||
workspace.register_action(|_: &mut Workspace, _: &SquareBrackets, cx: _| {
|
||||
object(Object::SquareBrackets, cx)
|
||||
});
|
||||
workspace.register_action(|_: &mut Workspace, _: &CurlyBrackets, cx: _| {
|
||||
object(Object::CurlyBrackets, cx)
|
||||
});
|
||||
workspace.register_action(|_: &mut Workspace, _: &AngleBrackets, cx: _| {
|
||||
object(Object::AngleBrackets, cx)
|
||||
});
|
||||
workspace.register_action(|_: &mut Workspace, _: &VerticalBars, cx: _| {
|
||||
object(Object::VerticalBars, cx)
|
||||
});
|
||||
}
|
||||
|
||||
fn object(object: Object, cx: &mut WindowContext) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue