How do you enable semantic highlighting for Python?

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

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • mason.nvim

    Portable package manager for Neovim that runs everywhere Neovim runs. Easily install and manage LSP servers, DAP servers, linters, and formatters.

  • I have pyright installed via mason which apparently support "semantic token highlighting" but have been having a hard time getting these colors to show up in a buffer. It seems Neovim has changed how it handles semantic highlighting a few times so there's still some conflicting information online. It's hard to know what's current and what's not. Any help would be greatly appreciated.

  • pylyzer

    A fast static code analyzer & language server for Python

  • That explains why I didn't see textDocument/semanticTokens/full or anything like it in pyright's code. Do you happen to know of any Python LSP that has semantic tokens? pylsp, pyright, and jedi-language-server all don't have it. The only one I could find that might support it is https://github.com/mtshiba/pylyzer but I haven't tried that LSP yet

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • pyright

    Static Type Checker for Python

  • Unfortunately, pyright explicitly stated that they are not interested in inlay hints or other language server features, that those will only be added to pylance. That's why I added it myself instead of submitting a pull request to pyright. See https://github.com/microsoft/pyright/issues/4325

  • pyright-inlay-hints

    Static Type Checker for Python

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