Git Product home page Git Product logo

Comments (27)

PMassicotte avatar PMassicotte commented on July 18, 2024 2

Just made a PR to treesitter that fixes it: nvim-treesitter/nvim-treesitter-textobjects#645

from r.nvim.

typhooncamel avatar typhooncamel commented on July 18, 2024 1

Ah, yes, that did it. Thanks!

from r.nvim.

jalvesaq avatar jalvesaq commented on July 18, 2024

I updated my plugins and can replicate the bug. I removed R.nvim and cmp-r from my lazy.nvim config and the bug remains. So, the problem seems to be with nvim-treesitter.

from r.nvim.

jalvesaq avatar jalvesaq commented on July 18, 2024

I deleted the nvim-treesitter directory (~/.local/share/nvim/lazy/nvim-treesitter). Everything was installed again by lazy.nvim and the error messages disappeared.

from r.nvim.

samtrek avatar samtrek commented on July 18, 2024

Not fixed from on my own side

from r.nvim.

samtrek avatar samtrek commented on July 18, 2024

better to remove some of the plugins that may be conflicting with nvim.tressitter, I remove hlargs.nvim and restarted nvim, everything is back to normal.

from r.nvim.

PMassicotte avatar PMassicotte commented on July 18, 2024

r-lib/tree-sitter-r#129 (comment)

from r.nvim.

samtrek avatar samtrek commented on July 18, 2024

after the bug report I wrote was closed, I was referred to their pined comment this
nvim-treesitter/nvim-treesitter#3092
so you may check it out also to diagnose what the issue may be

from r.nvim.

PMassicotte avatar PMassicotte commented on July 18, 2024

just using

        "nvim-treesitter/nvim-treesitter",
        commit = "173515a5d2be6e98c2996189f77ee5993620e2aa",

for now

from r.nvim.

jalvesaq avatar jalvesaq commented on July 18, 2024

Did you try:

  1. Close Neovim.
  2. Delete all parsers:
cd ~/.local/share/nvim/lazy
rm -rf nvim-treesitter/
  1. Start Neovim again.

My nvim-treesitter config:

    {
        "nvim-treesitter/nvim-treesitter",
        tag = nil,
        branch = "master",
        run = ":TSUpdate",
        config = function ()
            require("nvim-treesitter.configs").setup({
                sync_install = true,
                ensure_installed = {
                    "bash",
                    "c",
                    "css",
                    "html",
                    "json",
                    "latex",
                    "lua",
                    "markdown",
                    "markdown_inline",
                    "python",
                    "query",
                    "r",
                    "rnoweb",
                    "vim",
                    "vimdoc",
                    "yaml",
                },
                highlight = {
                    enable = true,
                },
            })
            vim.o.foldmethod = "expr"
            vim.o.foldexpr = "nvim_treesitter#foldexpr()"
            vim.o.foldenable = false
        end
    },

from r.nvim.

PMassicotte avatar PMassicotte commented on July 18, 2024

Yes. I tried it and get the same error. Looks like the bug is known per discussions going on in the PR. It works for you? Have you tried to re-update all plugins after re-instslling them?

from r.nvim.

jalvesaq avatar jalvesaq commented on July 18, 2024

It fixed the bug here. I didn't uninstall any other plugins. I only deleted nvim-treesitter directory and let lazy.nvim install it again. I'm using the development version of Neovim.

from r.nvim.

typhooncamel avatar typhooncamel commented on July 18, 2024

I feel like I've been having some version of this issue as well. I initially fixed it, I thought, by deleting the nvim-treesitter directory, but now I'm getting errors again. When I delete the nvim-treesitter directory, and reinstall treesitter, I first get this error:

nvim-treesitter[r]: Error during tarball extraction.                                                                          
tar (child): tree-sitter-r.tar.gz: Cannot open: No such file or directory                                                     
tar (child): Error is not recoverable: exiting now                                                                            
tar: Child returned status 2                                                                                                  
tar: Error is not recoverable: exiting now

but once I close and reopen an R file, it goes back to the previous error (and then there's no syntax highlighting):

Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: /usr/share/nvim/runtime/filetype.lua:36: BufReadPost Autocommands for "*"..FileType Autocommands for "*": Vim(append):Error executing lua callback: /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 12:2
. Invalid node type "if":
(if
 ^

stack traceback:
        [C]: in function '_ts_parse_query'
        /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:252: in function 'fn'
        /usr/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'fn'
        /usr/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'get_query'
        ...r-textobjects/lua/nvim-treesitter/textobjects/shared.lua:99: in function 'available_textobjects'
        ...r-textobjects/lua/nvim-treesitter/textobjects/select.lua:173: in function 'attach'
        ...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:509: in function 'attach_module'
        ...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:532: in function 'reattach_module'
        ...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:133: in function <...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:132>
        [C]: in function 'nvim_cmd'
        /usr/share/nvim/runtime/filetype.lua:36: in function </usr/share/nvim/runtime/filetype.lua:35>
        [C]: in function 'pcall'
        vim/shared.lua: in function <vim/shared.lua:0>
        [C]: in function '_with'
        /usr/share/nvim/runtime/filetype.lua:35: in function </usr/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function '_with'
        /usr/share/nvim/runtime/filetype.lua:35: in function </usr/share/nvim/runtime/filetype.lua:10>

I should point out that everything was working absolutely fine until treesitter updated. Other file types also seem to be fine.

from r.nvim.

typhooncamel avatar typhooncamel commented on July 18, 2024

Apologies, it seems that my issue is with nvim-treesitter-textobjects, not R.nvim.

from r.nvim.

PMassicotte avatar PMassicotte commented on July 18, 2024

treesitter-r has been updated, and it breaks nvim-treesitter. Looks like they are working on it.

from r.nvim.

typhooncamel avatar typhooncamel commented on July 18, 2024

In my case, at least, disabling nvim-treesitter-textobjects means I no longer have error messages. When following the advice here , the result of :echo nvim_get_runtime_file('queries/<lang>/*.scm', v:true) includes subdirectories of that plugin that are not under nvim-treesitter. Unless I'm confusing things.

from r.nvim.

PMassicotte avatar PMassicotte commented on July 18, 2024

How do you disable textobjects?

from r.nvim.

typhooncamel avatar typhooncamel commented on July 18, 2024

I either comment out the dependency within the nvim-treesitter plugin setup, or I comment out the textobjects = { } table. Either means that the R file loads without errors, and with syntax highlighting.

from r.nvim.

PMassicotte avatar PMassicotte commented on July 18, 2024

Got it! The thing is I am using textobjecsts a lot!

from r.nvim.

typhooncamel avatar typhooncamel commented on July 18, 2024

Oh, I'd rather not have to disable it! I just don't know whether I should report it there too. Did disabling it fix it for you too?

from r.nvim.

PMassicotte avatar PMassicotte commented on July 18, 2024

yes it worked, but went back to an older commit of treesitter (see above) until they fix it. See nvim-treesitter/nvim-treesitter#6774

from r.nvim.

typhooncamel avatar typhooncamel commented on July 18, 2024

Going back to that commit in treesitter for some reason still didn't work for me...

from r.nvim.

PMassicotte avatar PMassicotte commented on July 18, 2024

Are you using lazy? If so make sure you run :Lazy update.

from r.nvim.

PMassicotte avatar PMassicotte commented on July 18, 2024

Fixed here:

nvim-treesitter/nvim-treesitter-context@a1d11bf#diff-2d143a41bea91e0dbb3b0c94323bc51db645cc47cdadafbe7d347dd3e89b4142

from r.nvim.

PMassicotte avatar PMassicotte commented on July 18, 2024

Talked too soon....

image

from r.nvim.

jalvesaq avatar jalvesaq commented on July 18, 2024

An issue related to the tree-sitter is that when sending the following line to the R Console only x <- 1 is sent:

x <- 1; y <- 2

Although the syntax is valid, practically nobody uses semicolons in R scripts. So, I don't see fixing this issue as a priority.

from r.nvim.

PMassicotte avatar PMassicotte commented on July 18, 2024

Good catch. I will look at it.

from r.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.