aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/matching_brace.rs
diff options
context:
space:
mode:
authorMikhail Rakhmanov <[email protected]>2020-06-03 19:10:54 +0100
committerMikhail Rakhmanov <[email protected]>2020-06-03 19:10:54 +0100
commiteefa10bc6bff3624ddd0bbb6bc89d8beb4bed186 (patch)
tree15c38c2993c52f4065d338090ca9185cc1fcd3da /crates/ra_ide/src/matching_brace.rs
parenta9d567584857b1be4ca8eaa5ef2c7d85f7b2845e (diff)
parent794f6da821c5d6e2490b996baffe162e4753262d (diff)
Merge branch 'master' into assists_extract_enum
Diffstat (limited to 'crates/ra_ide/src/matching_brace.rs')
-rw-r--r--crates/ra_ide/src/matching_brace.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/crates/ra_ide/src/matching_brace.rs b/crates/ra_ide/src/matching_brace.rs
index b85348706..407a9636d 100644
--- a/crates/ra_ide/src/matching_brace.rs
+++ b/crates/ra_ide/src/matching_brace.rs
@@ -1,7 +1,16 @@
1//! FIXME: write short doc here
2
3use ra_syntax::{ast::AstNode, SourceFile, SyntaxKind, TextSize, T}; 1use ra_syntax::{ast::AstNode, SourceFile, SyntaxKind, TextSize, T};
4 2
3// Feature: Matching Brace
4//
5// If the cursor is on any brace (`<>(){}[]`) which is a part of a brace-pair,
6// moves cursor to the matching brace. It uses the actual parser to determine
7// braces, so it won't confuse generics with comparisons.
8//
9// |===
10// | Editor | Action Name
11//
12// | VS Code | **Rust Analyzer: Find matching brace**
13// |===
5pub fn matching_brace(file: &SourceFile, offset: TextSize) -> Option<TextSize> { 14pub fn matching_brace(file: &SourceFile, offset: TextSize) -> Option<TextSize> {
6 const BRACES: &[SyntaxKind] = 15 const BRACES: &[SyntaxKind] =
7 &[T!['{'], T!['}'], T!['['], T![']'], T!['('], T![')'], T![<], T![>]]; 16 &[T!['{'], T!['}'], T!['['], T![']'], T!['('], T![')'], T![<], T![>]];