How to implement syntax highlighting for a custom language?

This page summarizes the projects mentioned and recommended in the original post on /r/vscode

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • vscode-euphoria

    Euphoria language support and debugging for Visual Studio Code

  • If you're looking for a simple example of implementing syntax highlighting, check out my plugin for Euphoria: https://github.com/OpenEuphoria/vscode-euphoria

  • Visual Studio Code

    Visual Studio Code

  • I'm pretty sure rust-analyzer relies on the built-in Rust grammars for basic syntax highlighting. But it also provides Semantic Tokens, part of the LSP specification since version 3.16. This does give the language server itself the ability to provide syntax highlighting information, but it is normally used as a complement to TextMate grammars. See this sample for a simple example of semantic tokens (although the sample doesn't use LSP, just the vscode API). Since you mentioned rust-analyzer, have a look at how they register and handle semantic tokens for LSP.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts