R-nvim / R.nvim

Neovim plugin to edit R files
GNU General Public License v3.0
176 stars 18 forks source link

Syntax highlighting is not enabled in the help window #200

Closed gssfaw closed 3 months ago

gssfaw commented 3 months ago

I've recently noticed that syntax highlighting in the help window is not enabled when I press rh. I can turn it on with the command :TSEnable highlight. Here is the minimal init.lua file:

init.lua ```lua vim.g.mapleader = [[\]] vim.g.maplocalleader = [[,]] local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or 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({ { { "R-nvim/R.nvim", lazy = false }, { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate", config = function() require("nvim-treesitter.configs").setup({ ensure_installed = { "markdown", "markdown_inline", "r", "rnoweb", "yaml" }, }) end }, "R-nvim/cmp-r", { "hrsh7th/nvim-cmp", config = function() require("cmp").setup({ sources = { { name = "cmp_r" } } }) require("cmp_r").setup({}) end, }, } } ) ```

nvim --version NVIM v0.10.1

https://github.com/user-attachments/assets/595a9b27-d43c-4ce7-9e51-6e188c25a2e5

jalvesaq commented 3 months ago

I have this in nvim-treesitter config:

return
    {
        "nvim-treesitter/nvim-treesitter",
        run = ":TSUpdate",
        config = function ()
            require("nvim-treesitter.configs").setup({
                sync_install = true,
                --- ... other options
                highlight = {
                    enable = true,
                },
                --- ... other options
            })
        end,
    },
gssfaw commented 3 months ago

@jalvesaq I've included it in the minimal config, but the problem persists. I did a git bisect and it looks like the problem was introduced with the commit 1d2e6c303b2bde089e18b0d7cc5e56b79332cc5e . I don't really know why it happens, but changing the "filetype" back to "syntax" in line https://github.com/R-nvim/R.nvim/blob/1d2e6c303b2bde089e18b0d7cc5e56b79332cc5e/lua/r/rdoc.lua#L18 fixes the issue

PMassicotte commented 3 months ago

I am not sure what is going on, but it is working on my side

https://asciinema.org/a/MMB0wtnuXAFVGnKrP6MJubtsl

gssfaw commented 3 months ago

I am so sorry, I forgot that the ftplugin is still loaded with a different init file. And I had some silly mistake in my rmd ftplugin file. Removing it solves the problem. Previously, because I wanted to get some features working for the latex code block, I was calling vimtex from the rmd ftplugin.

Reading the output of the messages command helped, I didn't notice it before, because it wasn't the red error color