rzukic / zed-latex

33 stars 4 forks source link

Add `brackets.scm` for latex #11

Closed lnay closed 2 months ago

lnay commented 3 months ago

This includes curly braces, square brackets, mathematical delimiters with \left and right, and \begin and \end declarations for environments and other ways of entering mathmode ($, $$, \[\], \(\)). Normal brackets and quotations are not strictly part of the syntax and the parser groups them into "words" so queries cannot be made for them anyway (unless used with \left and \right).

The end result is visual indicators for whatever currently "surrounds" the current position of the cursor.

https://github.com/user-attachments/assets/844aae54-0582-48f8-a12f-ae212372830b

Limitation: Other editors sometimes highlight \left( and \right) in

$\left(\frac{m}{n}\right)$

but \left and ( are separate nodes in the syntax tree so can't seem to capture both at the same time, so only the brackets are highlighted.