ChimeHQ / Chime

An editor for macOS
https://www.chimehq.com
BSD 3-Clause "New" or "Revised" License
300 stars 14 forks source link

Multi-pass Highlighting #8

Closed mattmassicotte closed 7 months ago

mattmassicotte commented 7 months ago

I really want to add this support to Neon, and it's close!

However, to actually test it, I needed to get semantic tokens from a language server. That required wiring up a lot of stuff so that document-level information can be accessible and, whew, that's been some work. But I'm super happy with the infrastructure.

mattmassicotte commented 7 months ago

More or less done with 053a7645eec56452c4b3a9b6cc438e717c037118.

Actually doing this required two things I didn't have, and which were non-trivial. The first was a fallback tokenizer. That project is started, but is currently bad: https://github.com/ChimeHQ/Lowlight

The second was a proper document->extension connection. This a fair bit of work, and doing it required modifying the ChimeKit API slightly.

The app can now successfully do three-phase highlighting for Go. I was going to do Swift, but something is wrong with sourcekit-lsp's semantic tokens support. I know that gopls works, so I used it as a proof-of-concept.