Git Product home page Git Product logo

Comments (17)

jalvesaq avatar jalvesaq commented on August 18, 2024 1

It's fixed now.

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024 1

Thanks for reporting the issue and all the feedback!

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024

This plugin doesn't auto-format when saving. As before, you have to manually select some lines and do :RFormat.

I will look at the other two bugs.

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024

The csv_app options should be fixed now.

I can't replicate the Object Browser bug, but if you still see the problem, I can add a "redraw" to see if it is fixed.

from r.nvim.

bassamsdata avatar bassamsdata commented on August 18, 2024

The csv_app options should be fixed now.

Yes, it worked. Thank you. However, I'm trying to make it more interactive since it accepts a function like this:

csv_app = function(tsv_file)
	local app = vim.fn.input("Enter the application name: ")
	if app == "" then
		app = "tad"
	end
	vim.cmd("tabnew | terminal " .. app .. " " .. tsv_file)
	vim.cmd("startinsert")
end,

But this didn't work. I'm not sure if this is how we should set it up, but the app complains that the file tsv doesn't exist, even though the app gets the name correctly.

I can't replicate the Object Browser bug, but if you still see the problem, I can add a "redraw" to see if it is fixed.

I still have the issue, but that's okay. It's just a bit inconvenient; I can get used to it.

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024

Your function worked for me, but, while converting VimScript to Lua, in some cases, I had to call more interactive functions through vim.schedule. So, you could try:

                csv_app = function(tsv_file)
                    vim.schedule(function ()
                        vim.ui.input({ prompt = "Enter the application name: "}, function (input)
                            if input == "" then
                                input = "vd"
                            end
                            vim.cmd("tabnew | terminal " .. input .. " " .. tsv_file)
                            vim.cmd("startinsert")
                        end)
                    end)
                end,

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024
  • The rbrowser (<localleader>ro) doesn't refresh when I open it until I perform some assignment (like if I was working and open it, it shows nothing until I do some assignment).

Could you try this:

                hook = {
                    after_ob_open = function ()
                        vim.cmd("redraw")
                    end,
                },

If it solves the issue, I will add vim.cmd("redraw") to lua/r/browser.lua.

from r.nvim.

bassamsdata avatar bassamsdata commented on August 18, 2024

Your function worked for me, but, while converting VimScript to Lua, in some cases, I had to call more interactive functions through vim.schedule.

Thank you for your feedback. Actually, both of them didn't work for me, and they produced the same result on Neovim stable 0.9.5 and nightly. I initially avoided using vim.ui.input because of its async nature, but even with vim.schedule, I had the same experience.

If it solves the issue, I will add vim.cmd("redraw") to lua/r/browser.lua.

Unfortunately, didn't solve the issue for me. I even tried calling redraw on rbrowser manually, but nothing happened until I performed a different assignment, after which it refreshed.

I'll try to create a minimal repro today and update here. It might be a configuration issue, but I'm not sure yet.

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024

I'm sorry! I was using a very small data.frame (only two lines) and didn't note that vd created an empty sheet. In fact, the data.frame wasn't being saved for the hook function. It should work now.

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024

I've also replaced some VimScript functions with Lua ones in browser.lua, but I don't believe that this will make any difference.

from r.nvim.

bassamsdata avatar bassamsdata commented on August 18, 2024

In fact, the data.frame wasn't being saved for the hook function. It should work now.

It works like a charm right now, thank you.

I've also replaced some VimScript functions with Lua ones in browser.lua, but I don't believe that this will make any difference.

Unfortunately, the issue persists. Even after reopening the rbrowser and applying assignments, nothing appears. Here's a minimal reproducible code:

Steps to reproduce:

  1. Create a minimal.lua file as described below.
  2. Run 'nvim --clean -u minimal.lua'.
  3. Open any R file, perform some assignments, then use '\ro'.
  4. Repeat the process of doing assignments and then again '\ro' to hide and then \ro to show, and notice that nothing appears in this session again.

minimal.lua:

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({
	{
		"jalvesaq/tmp-R-nvim",
		lazy = false,
		config = function()
			local opts = {
				csv_app = function(tsv_file)
					vim.schedule(function()
						vim.ui.input({ prompt = "Enter the application name: " }, function(input)
							if input == "" then
								input = "vd"
							end
							vim.cmd("tabnew | terminal " .. input .. " " .. tsv_file)
							vim.cmd("startinsert")
						end)
					end)
				end,
				R_args = { "--quiet", "--no-save" },
				hook = {
					after_ob_open = function()
						vim.cmd("redraw")
					end,
					after_config = function()
						if vim.o.syntax ~= "rbrowser" then
							vim.api.nvim_buf_set_keymap(0, "n", "<Enter>", "<Plug>RDSendLine", {})
							vim.api.nvim_buf_set_keymap(0, "v", "<Enter>", "<Plug>RSendSelection", {})
						end
					end,
				},
			}
			require("r").setup(opts)
		end,
	},
}, {})

here is a video for minimal rero, describing the issue:

Kapture.2024-02-20.at.21.06.29.mp4

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024

I figured out what was the problem. It was updating immediately only when cmp-r was installed. Should be fixed now.

from r.nvim.

bassamsdata avatar bassamsdata commented on August 18, 2024

thank you for the hard work. yes it worked and objects will show up in the first time you open it.

However, have you attempted to close and reopen it? After doing so, it fails to display anything, regardless of the actions taken thereafter.

from r.nvim.

bassamsdata avatar bassamsdata commented on August 18, 2024

When closing it, I believe there's a message in the echo area. I've now noticed this. It's in the job.lua:58 file.

from r.nvim.

bassamsdata avatar bassamsdata commented on August 18, 2024

It works perfectly now, thank you. I really appreciated!

from r.nvim.

jalvesaq avatar jalvesaq commented on August 18, 2024

Note: the immediate update will not work on Windows.

from r.nvim.

PMassicotte avatar PMassicotte commented on August 18, 2024

Just my 2 cents, tidy-viewer is also working great

https://github.com/alexhallam/tv

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.