Git Product home page Git Product logo

Comments (16)

jalvesaq avatar jalvesaq commented on August 18, 2024 1

I updated the branch fix_get_lang...

from r.nvim.

carschandler avatar carschandler commented on August 18, 2024

Seems to be any time I'm on the last line of the chunk

from r.nvim.

PMassicotte avatar PMassicotte commented on August 18, 2024

Probably something off by 1 somewhere.

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024

I confirm the bug. It works in Quarto, but not in RMarkdown.

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024

Trying to debug this issue, I changed lualine_x in my lualine config to show the output of get_lang().

                sections = {
                    lualine_a = { "mode" },
                    lualine_b = { {'branch', icon = ''}, "diagnostics" },
                    lualine_c = { "filename", "searchcount",  },
                    -- lualine_x = { selectionCount },
                    lualine_x = { require("r.utils").get_lang },
                    lualine_y = { {rstatus, color = rsttcolor }},
                    lualine_z = { "progress", "location" },
                },

After that, the bug disappeared, even if I removed get_lang from my lualine config. However, based on the error message that I got in my first attempt to display the output of get_lang in the Neovim status line, I created the branch https://github.com/R-nvim/R.nvim/tree/fix_get_lang

Could you try it and see if it makes any difference (since I could no longer replicate the bug even before the changes)?

from r.nvim.

lokesh-krishna avatar lokesh-krishna commented on August 18, 2024

On the fix_get_lang branch but still face both issues. Alt-- results in <M--> instead of the usual <-. Get notified that I'm not in inside a R or Python code chunk. This even happens when I'm not on the last line in a chunk.

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024

It works on my side. So, we might have different tree-sitter parsers. You can try:

  • The command :TSUpdate
  • Add "yaml" to the list of parsers to be installed.
  • Delete the nvim-treesitter directory to force the installation of new parsers.

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024

On the main branch, if I have a chunk of R code in an Rmd file with just two lines, x and y, and press <M--> three times after x and after y I get:

x <-  <-  <- 
y <- <M--><M-->

On the fix_get_lang branch, I get:

x <-  <-  <- 
y <-  <-  <- 

So, I believe that now I know how to replicate the bug reliably and that it is fixed on the fix_get_lang branch.

from r.nvim.

lokesh-krishna avatar lokesh-krishna commented on August 18, 2024

I followed the instructions regarding tree-sitter and am on the latest update on the fix_get_lang branch. With my test file. I still face the issue of R.nvim saying Not inside R or Python code chunk. I'm not sure if this is the same issue as what has been discussed and resolved here though. Should this conversation continue here or should I open a new issue?

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024

It's the same issue. It's fixed here, but not there. I tried nvim 0.9-5 (from the Debian package) and nvim 0.11.0-dev (installed from source some days ago). Because I can't replicate the issue, the only thing that I can do is merge the branch anyway since it at least fixes the bug on my side.

from r.nvim.

lokesh-krishna avatar lokesh-krishna commented on August 18, 2024

Is there any recommendation you have for troubleshooting this? Sorry for the trouble 🙈
EDIT: Facing this issue in Quarto.
EDIT: I can get it to reliably work as long as my cursor is on the firstl line of the code block. Anything else and it won't work.

from r.nvim.

lokesh-krishna avatar lokesh-krishna commented on August 18, 2024

Okay, I'm facing this issue with everything other than RSendParagraph and RDSendParagraph. These 2 work and the rest don't.

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024

Next attempt:

Create the simplest Quarto document that replicates the bug and run this command:

:InspectTree

Post here the quarto document and the contents of the left window (the tree of nodes of treesitter).

It will also help if you enable treesitter highlighting instead of Vim's syntax highlight because you will see if treesitter is recognizing the code as R.

from r.nvim.

lokesh-krishna avatar lokesh-krishna commented on August 18, 2024

image

I do have tree-sitter syntax highlighting enabled. Everything else works fine in the code block (LSP diagnostics, auto-complete, etc). I'm even able to send lines to R, but only if I'm using RSendParagraph or RDSendParagraph. The line and selection based ones are the ones that throw the Not inside R or Python code chunk.

However, the line based ones do work after I've run :InspectTree. They continue to work even after I've closed the InspectTree window. What might be up here?

Trying to debug this issue, I changed lualine_x in my lualine config to show the output of get_lang().

It sounds kinda similar to this situation, doesn't it?

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024

With exactly the same 7 lines in a .Rmd I get exactly the same output.

However, the line based ones do work after I've run :InspectTree. They continue to work even after I've closed the InspectTree window. What might be up here?

Perhaps lazy=false in nvim-treesitter could make a difference...

from r.nvim.

lokesh-krishna avatar lokesh-krishna commented on August 18, 2024

It didn't :(

Really appreciate y'all being so patient with me. I'll just continue trying to figure this one out and share any updates.

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.