FluxxField / bionic-reading.nvim

Toggle Bionic Reading for Neovim buffers using syllable based highlighting
MIT License
44 stars 0 forks source link

TreeSitter Not Working #64

Closed jam1015 closed 6 months ago

jam1015 commented 6 months ago

Not getting treesitter hightlighting with this minimal config:

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup(
{
  {'nvim-treesitter/nvim-treesitter',
  config = function()
    require'nvim-treesitter.configs'.setup {
      -- A list of parser names, or "all" (the five listed parsers should always be installed)
      ensure_installed = { "c", "lua", "vim", "vimdoc", "query" },

      -- Install parsers synchronously (only applied to `ensure_installed`)
      sync_install = false,

      -- Automatically install missing parsers when entering buffer
      -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
      auto_install = true,

      -- List of parsers to ignore installing (or "all")
      ignore_install = { "javascript" },

      ---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
      -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!

      highlight = {
  enable = true,

  -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
  -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
  -- the name of the parser)
  -- list of language that will be disabled

  -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
  -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
  -- Using this option may slow down your editor, and you may see some duplicate highlights.
  -- Instead of true it can also be a list of languages
  additional_vim_regex_highlighting = false,
      },
    }
  end

},

{
  "folke/tokyonight.nvim",
  lazy = false,
  priority = 1000,
  opts = {},
},
{
  'FluxxField/bionic-reading.nvim',
  config = function()
    require('bionic-reading').setup({
      -- determines if the file types below will be
      -- automatically highlighted on buffer open
      auto_highlight = true,
      -- the file types you want to highlight with
      -- the node types you would like to target
      -- using treesitter
      file_types = {
  ["text"] = {
          "any", -- highlight any node
  },
  -- EX: only highlights comments in lua files
  ["lua"] = {
          "any",
  },
      },
      -- the highlighting styles applied
      -- IMPORTANT - if link is present, no other
      -- styles are applied
      hl_group_value = {
  link = "Bold",
      },
      -- Flag used to control if the user is prompted
      -- if BRToggle is called on a file type that is not
      -- explicitly defined above
      prompt_user = true,
      -- Enable or disable the use of treesitter
      treesitter = true,
      -- Flag used to control if highlighting is applied as
      -- you type
      update_in_insert_mode = true,
    })
  end,
}
}

)

vim.cmd([[colorscheme tokyonight]])

I get highlighting when I set 'treesitter = false'. Adding or removing the colorscheme command doesn't help. I have confirmed that everything is up to date with all the treesitter parsers.

FluxxField commented 6 months ago

Looking into this ATM. So far from my testing _treesitter_highlight is running as expected and pcall(vim.treesitter.get_parser) is returning true. Probably an issue with _apply_highlighting

FluxxField commented 6 months ago

Should be all good! I mentioned it in the PR but I will also mention it here.

@jam1015 Please feel free to reach out if there are any issues.

Thank you again.