Syntax Highlighting, LSP, and Themes

It looked like this week was twice as productive as usual, then I realized half the code was serialization and test-related which isn't as difficult to write.

This week was displaying source code with syntax highlighting. First, I needed to parse the 'semanticTokensProvider' field in an LSP initialize response. It's an optional field that holds the legend needed to decode the semanticTokens response. Next was obviously the semanticTokens response, parsing it into a more friendly structure and sending it asynchronously to the main thread.

The middle of the week was rendering the text properly and using semantic tokens from the LSP. However, depending on the LSP, it may not tell you what text is a comment or a keyword. I also wanted the source code to look decent when there is no LSP, so I wrote code for syntax highlighting. Some examples are in C I have '#include' and the 'header.h' in different colors. In a string literal, I have escape characters (like '\n') in a different color. I wanted to show a picture, but I think I should improve both the light and dark themes before I show anything.

Yesterday, I wrote some code to read the theme from a text file. It's not done, but I plan to improve the theme by modifying the text file instead of hard coded values directly.