Skip to content

Commit

Permalink
add tuple patterns to outline-jump-rust
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Apr 6, 2022
1 parent e6ec59b commit d8133de
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dotfiles/kakoune/rc/tree-grepper.kak
Expand Up @@ -40,7 +40,7 @@ define-command -override -docstring "jump somewhere in an Haskell file's definit
}

define-command -override -docstring "jump somewhere in an Rust file's definition outline" -params 0..1 outline-jump-rust %{
outline-jump rust "(use_declaration (_)@use) (function_item (identifier)@function) (function_signature_item (identifier)@function) (struct_item (type_identifier)@struct) (field_declaration)@field (impl_item (type_identifier)@impl) (parameter)@arg (self_parameter)@arg (let_declaration (identifier)@let) (enum_item (type_identifier)@enum) (enum_variant (identifier)@enum)"
outline-jump rust "(use_declaration (_)@use) (function_item (identifier)@function) (function_signature_item (identifier)@function) (struct_item (type_identifier)@struct) (field_declaration)@field (impl_item (type_identifier)@impl) (parameter)@arg (self_parameter)@arg (let_declaration (identifier)@let) (let_declaration (tuple_pattern (identifier)@let)) (enum_item (type_identifier)@enum) (enum_variant (identifier)@enum)"
}

define-command -override -docstring "jump somewhere in a Markdown file's outline" -params 0..1 outline-jump-markdown %{
Expand Down
14 changes: 14 additions & 0 deletions sample-projects/rust/src/main.rs
Expand Up @@ -22,6 +22,20 @@ impl Foo {
let to_add = 1;
self.count += to_add
}

fn returns_tuple(&self) -> (int, bool) {
(1, true)
}

fn consumes_tuple(&self) -> bool {
let (base, should_double) = self.returns_tuple();

if should_double {
base * 2
} else {
base
}
}
}

impl Drop for Foo {
Expand Down

0 comments on commit d8133de

Please sign in to comment.