Conversation
|
There should be some existing code for finding matching brackets that you can have a look/reuse. |
|
I'm not an expert, maybe @dzhou121 would know better than me, but I'm pretty sure Tree sitter can give us enough information for all scope (bracket, curly brackets, parenthesis, etc.) |
e.g. here https://github.com/lapce/lapce/blob/master/lapce-data/src/document.rs#L2515 |
|
Looking good! Thanks for your good work. I think let's keep the current pairs for this PR, and maybe explore other pairs in future PRs? |
|
any chance this PR can be expanded to colorized matching pairs, and maybe scope line? I understand if you'd instead leave that for later, but I figured I might suggest it just in case |
Sure 👍.
I thought about this and I'll leave the PR as is and probably try implementing the colorized brackets/scopes next. It's going to take me some time to research how to best implement this and I think the bracket matching is already a nice to have feature. Hope that's okay. |
Fair enough! Bracket matching is already amazing. Can't wait to see the next steps :) |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1421 +/- ##
=========================================
+ Coverage 6.84% 6.91% +0.06%
=========================================
Files 126 126
Lines 52705 52868 +163
=========================================
+ Hits 3609 3654 +45
- Misses 49096 49214 +118 ☔ View full report in Codecov by Sentry. |
It would be very helpful!!! VSCode doesn't highlight them, and it's really painful for fairly complex types, even at the second nesting level. I don't want to use Helix either, because it doesn't show inferred types. Having both inferred types and |
I opened an issue to keep track of stuff to add (#1439), because I think I'll try to get this merged first and keep track of the rest for later. |
|
LGTM. Thanks for your amazing work! |
This PR adds matching brackets highlighting to Lapce.
This is a WIP, but I got the basic functionality working so I thought I'd share this as a draft.
The basic idea is to check if a bracket is at the cursor, looking for the closing one and highlighting them.
I'm not quite happy with the search of the matching bracket, but am currently out of ideas/inspiration for a different implementation. Maybe someone has a better idea, especially how to handle multiple scopes.
Feel free to discuss and comment.
Closes #974