1

I'm having an issue with syntax highlighting for FastAPI decorators. In VSCode everything works perfectly out of the box (after installed some Python extensions), but in Neovim the whole decorator section has the same color (tried with a lot a color schemes)

Code looks like this in Neovim Syntax highlighting in Neovim Same code looks like this in VSCode: Syntax highlighting in VSCode This is my treesitter config:

{
  'nvim-treesitter/nvim-treesitter',
  build = ':TSUpdate',
  main = 'nvim-treesitter.configs',
  opts = {
    ensure_installed = { 'python', 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
    auto_install = true,
    highlight = {
      enable = true,
      additional_vim_regex_highlighting = { 'ruby' },
    },
    indent = { enable = true, disable = { 'ruby' } },
  },
},

I'm using Neovim 0.10.0, and this config based on kickstart.nvim.

I tried disabling other plugins but this is not solved my issue. If I disable treesitter for this buffer, the highlighting works as I expected.

1 Answer 1

0

You can take a look at my config which works fine in the circumstance: https://github.com/Graeme22/dotfiles/blob/1a51970dab0111f21568706258ddda166aa52121/.config/nvim/init.lua

Is your Python virtual environment activated? Can we see your entire init.lua? It's hard to know how to help here without more information.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.