mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 03:08:13 +00:00
HackStudio: Highlight maching parentheses as well
This can just piggyback on the code I just wrote for curly braces.
This commit is contained in:
parent
c8e02e60a6
commit
d5afc58744
1 changed files with 15 additions and 0 deletions
|
@ -229,13 +229,28 @@ void Editor::cursor_did_change()
|
|||
return;
|
||||
}
|
||||
|
||||
if (token_type == CppToken::Type::LeftParen && span.range.start() == cursor()) {
|
||||
auto buddy = find_span_of_type(i, CppToken::Type::RightParen, CppToken::Type::LeftParen, Direction::Forward);
|
||||
if (buddy != -1)
|
||||
make_buddies(i, buddy);
|
||||
return;
|
||||
}
|
||||
|
||||
auto right_of_end = span.range.end();
|
||||
right_of_end.set_column(right_of_end.column() + 1);
|
||||
|
||||
if (token_type == CppToken::Type::RightCurly && right_of_end == cursor()) {
|
||||
auto buddy = find_span_of_type(i, CppToken::Type::LeftCurly, CppToken::Type::RightCurly, Direction::Backward);
|
||||
if (buddy != -1)
|
||||
make_buddies(i, buddy);
|
||||
return;
|
||||
}
|
||||
|
||||
if (token_type == CppToken::Type::RightParen && right_of_end == cursor()) {
|
||||
auto buddy = find_span_of_type(i, CppToken::Type::LeftParen, CppToken::Type::RightParen, Direction::Backward);
|
||||
if (buddy != -1)
|
||||
make_buddies(i, buddy);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue