Implementing a Syntax Highlighter with Tree-Sitter.
One of the most important part of a text editor is having a syntax highlighting system. As such, I began looking into different implementations of how one might achieve syntax highlighting. I narrowed down how I would achieve this with either one of: A Lexer (Using a pre-made library or build one myself). An Abstract Syntax Tree (Using Tree Sitter). In terms of a lexer, it would read the entire file, concattenated as a string and then it would start parsing from there. This means that when we make a change in our file, we would have to concattenate each row again and reparse the file, this method seems inefficient unless you are using a data structure that allows fast string concattenations such as a rope. ...