diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-05-31 11:50:11 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-31 11:50:11 +0100 |
commit | 09df51dab89340bcf4b8ede95c02c32b0c8eb2bc (patch) | |
tree | 0240c629fe96243e1a1c91ccd679947bfb1ecb03 /crates/ra_ide/src/matching_brace.rs | |
parent | 5f7225446e75509ae0d971a6f3e2b9d3e37d6f2a (diff) | |
parent | 13a996f3b68c175f6e6ad8d89081e45850dc5583 (diff) |
Merge #4664
4664: Generate feature documentation from code r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/matching_brace.rs')
-rw-r--r-- | crates/ra_ide/src/matching_brace.rs | 13 |
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 | |||
3 | use ra_syntax::{ast::AstNode, SourceFile, SyntaxKind, TextSize, T}; | 1 | use 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 | // |=== | ||
5 | pub fn matching_brace(file: &SourceFile, offset: TextSize) -> Option<TextSize> { | 14 | pub 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![>]]; |