filipdutescu / renamer.nvim Goto Github PK
View Code? Open in Web Editor NEWVS Code-like renaming UI for Neovim, writen in Lua.
License: Apache License 2.0
VS Code-like renaming UI for Neovim, writen in Lua.
License: Apache License 2.0
Maybe this is intended behavior, if it is, there should be an option to switch it. When I trigger the plugin, the default cursor position is at the beginning of the line, I'd expect it to be at the end.
Steps to reproduce the behavior:
require('renamer').rename()
on somethingThe cursor position defaults to the end of the prompt in the popup.
It would be great to add all of the locations of the rename to the quickfix list in order to make writing the changes easier.
After renaming, add the locations of the renamed words to the quickfix list.
Using padding can introduce a lot of bugs with popup rendering, anywhere in the screen, as there is no validation on it.
Steps to reproduce the behavior:
rename()
Padding should be taken into consideration when drawing the popup.
<c-c>
inserts i
after clearing the line.
Steps to reproduce the behavior:
renamer
renamer.rename()
<c-c>
The line is cleared and no text is added to it.
There are no comments explaining all of the setup options and how they affect the popup.
Add comments in:
README.md
doc/renamer.txt
Error when trying to rename a variable.
Install latest neovim and renamer, try to rename a variable.
Variable should be renamed.
apply_workspace_edit must be called with valid offset encoding
Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/lsp/util.lua:366: offset_encoding: expected string, got nil
stack traceback:
[C]: in function 'error'
vim/shared.lua: in function 'validate'
/usr/share/nvim/runtime/lua/vim/lsp/util.lua:366: in function 'apply_text_edits'
/usr/share/nvim/runtime/lua/vim/lsp/util.lua:778: in function 'apply_workspace_edit'
...site/pack/packer/start/renamer.nvim/lua/renamer/init.lua:486: in function '_apply_workspace_edit'
...site/pack/packer/start/renamer.nvim/lua/renamer/init.lua:392: in function 'handler'
/usr/share/nvim/runtime/lua/vim/lsp.lua:1025: in function ''
vim.lua: in function <vim.lua:0>
Press ENTER or type command to continue
You can use an empty string as the new name, which should not be allowed.
Steps to reproduce the behavior:
renamer
renamer.rename()
An error should be issued and no renaming should take place (but the popup should close).
I get an error saying that changes
is nil
everytime I rename something. The renaming itself looks like it's working correctly though.
Steps to reproduce the behavior:
The symbol is renamed and no errors occur.
Just installed it and run its setup
function providing only the title. Then I am calling the rename
function through a mapping.
As title. The plugin I'm using cannot rename the Foo
.
First of all, thank you for making this amazing plugin!
The bug in question: horizontal padding can be removed with backspace and is interpreted as a part of the new variable name.
Set padding = { left = 3 }
(or any number greater than 0) in require('renamer').setup
and try renaming something with require('renamer').rename()
in eg. a python script:
The padding can be removed by simply pressing backspace a bunch:
and if, instead of removing, I simply confirm with <CR>
padding is interpreted as part of the new name (notice the 3 spaces in front of content
causing an indentation error):
The padding should be non-interactive and should not be treated like user input.
Besides <c-a>
and <c-i>
, all keymaps make the initial buffer stay in insert mode, regardless of the mode in which renamer.rename()
was called in.
Steps to reproduce the behavior:
renamer
renamer.rename()
while in normal
mode<c-a>
and <c-i>
(i.e. <c-e>
)insert
mode, instead of normal
The initial buffer should be in normal
mode, same as before calling renamer.rename()
.
This doesn't happen every time, and it seems to depend on the code.
sumneko_lua
local func = require("func")
return func.sum(1, 2)
func
with cursor on first linefunc
with cursor on second lineNote: what you see above first line is barbar.nvim
Currently, only the tag name is put in the title of the GitHub Release.
Add the project name to the title.
There is no way to select the buffer contents or to move easier and faster than 1 letter at a time.
Define key mappings to have better movement inside the renamer.nvim
popup buffer and window.
Start with the <cword>
selected. This might still be a good idea, but key mappings are more important, in my opinion.
When I activate rename the popup with the variable/function name is always prefixed with " )" (see screenshot)
config:
use {
'filipdutescu/renamer.nvim',
branch = 'master',
requires = { {'nvim-lua/plenary.nvim'} },
config = function()
require("renamer").setup()
end
}
leader - rn
Variable/function without being prefixed
When I try to use this command I get an error, it won't let me change the name of a function.
Use version 0.7.0 of neovim, try to use that command and then, at least for me, it gives error.
It is expected to perform the rename action after pressing enter.
Hi, first of all thanks for this plugin
I think that popup looks small, I'd like it to be wider
Is it possible to increase popup width? Maybe making it configurable by adding an option in setup()
Exiting renamer.rename()
(by submission or cancellation), after being called from normal
mode, puts the cursor back 1 character.
Steps to reproduce the behavior:
renamer
renamer.rename()
from normal
mode<cr>
) or cancellation (<esc>
)Cursor should remain in the initial position.
There is no proper documentation on highlight customization for vimdoc.
Add highlighting docs in doc/renamer.txt
.
There should be documentation on the public methods for users to reference in order to use the plugin.
Add documentation comments for the "public" methods.
Use only a Neovim doc file. This however is limiting, as one needs to have the plugin installed in Neovim and the editor open to reference it.
Prompt-mode seemed like a nice idea to have, but it breaks keymaps and there was no reason to add it besides having a nice prefix.
Steps to reproduce the behavior:
renamer
with a prompt prefix (i.e. '> '
)renamer.rename()
Keymaps work as intended
There is no way to know how the project works or looks.
Add images and videos which showcase the features and general use cases of the project. Add a few in the project README.md
.
Great project, I've been looking this type of plugin for a long time!
I personally would like it if there was a option to prompt the rename through the command input (not sure what its called) instead of a popup. It's just a personal thing, as I'm not a huge fan of having the popup.
It would be nice to have something like in the screenshot below
For example, in the line function renamer.rename(opts)
, if one wants to rename rename
, the popup won't show, as it appears once before, in the word renamer
.
Steps to reproduce the behavior:
renamer
to rename the rename
function nameThe popup should show up without problem.
When I rename a Java public class using renamer error appears and nothing is renamed. It's supposed to rename the class name, filename and references to the class in another files.
The error:
Error executing vim.schedule lua callback: ...l/.config/nvim/plugins/renamer.nvim/lua/renamer/init.lua:385: attempt to index field 'textDocument' (a nil value)
stack traceback:
...l/.config/nvim/plugins/renamer.nvim/lua/renamer/init.lua:385: in function 'handler'
/usr/share/nvim/runtime/lua/vim/lsp.lua:957: in function 'cb'
vim.lua:285: in function <vim.lua:285>
Steps to reproduce the behavior:
The class gets renamed, the file gets renamed and references to the class also get renamed
I can supply a dummy java project to reproduce this.
When using <C-c>
inside of the renamer window it will execute the default
clear line and I've tried to remapping so as that it will close the
renamer window like so:
use {
"filipdutescu/renamer.nvim",
branch = "master",
module = "renamer",
config = function()
local mappings_utils = require "renamer.mappings.utils"
require("renamer").setup {
mappings = {
["<c-e>"] = mappings_utils.set_cursor_to_end,
["<c-c>"] = "<Esc>",
["<c-u>"] = mappings_utils.clear_line,
},
}
end,
}
But is not working. So I was wondering what is the correct way
Thanks in advance.
Attempting to rename text with no LSP attached will fail silently after displaying prompt for new name.
Steps to reproduce the behavior:
lua require('renamer').rename()
on any word.A discreet message should be displayed and no input box should be opened if there is nothing to rename.
When LSP is attached the prompt will be shown also for invalid elements, but at least there is a warning displayed afterward.
Calling manually & from insert mode results in error, from normal mode it works, but no popup window. Only statusline.
Update: I have just confirmed that the statusline renaming is only due to the keybind being the same for my lsp rename function, and is in fact, not a part of this plugin at all. In any case, this is still broken, even more so than I had thought, but it at least helped figure out a few inconsistencies with this issue.
When I use the shortcut (<F2>
in insert) to call lua require("renamer").rename()
, or enter it manually, I get an error:
E5108: Error executing lua ...site/pack/packer/start/renamer.nvim/lua/renamer/init.lua:267: attempt to index local 'p' (a nil value)
stack traceback:
...site/pack/packer/start/renamer.nvim/lua/renamer/init.lua:267: in function '_create_default_popup_opts'
...site/pack/packer/start/renamer.nvim/lua/renamer/init.lua:135: in function 'rename'
[string ":lua"]:1: in main chunk
And when I run it from normal mode, it works, but it doesn't use the popup. Instead, it uses the statusline.
I would expect it to use the popup window at all times, and also to work instead of giving an error message.
Error from manually calling: https://i.imgur.com/iyZ8NYn.png
Working in statusline: https://i.imgur.com/VSOCdhI.png
There are no Neovim docs to reference the plugin while inside the editor.
Add a doc file for Neovim.
The popup should be able to work as a prompt, having a customizable prompt prefix etc.
Implement the prompt behaviour for the popup buffer.
There is no README.md
for tests, in order to help contributors and users run tests and describe how to write others.
Add a lua/tests/README.md
described how to run and write tests. It should also describe the frameworks and dependencies used for tests and how they should be structured.
When border is toggled off, popup is drawn 1 character away from the word start.
Steps to reproduce the behavior:
renamer
with border = false
rename()
The popup should be aligned with the word start.
If applicable, add screenshots to help explain your problem.
Add any other context about the problem here.
Neovim 0.6.0 added vim.ui.input
. Could it be a good alternative to reduce dependencies
It is not clear enough what word is being renamed.
Highlight the occurrences of the word to be renamed, using LSP to match per-scope.
There are times that I just want to write a NEW name, and not renaming a part of it, and therefore deleting whole word and inputting a new one is slower.
Add a paremeter in the rename function so I can make a dedicated mapping that will open the popup without any value in it, so I can just write the new name fast and easy.
I would like to be able to attach a handler to textDocument/rename which I can use to display renamed changes using nvim-notify.
It would be nice to be able to pass a custom handler function into the rename function.
I am currently doing my own renamer (not too sure how to get the popup UI - which is why I want to try out this plugin.
This is the handler function I am currently using:
This is how I am passing it into textDocument/rename:
There is currently no checks on screen edges when drawing the popup.
The project should take the edges into account and position the popup in a way that it is not obstructed by them.
There is no way to opt-out of references highlighting.
Make references highlighting optional through a new option in setup()
, which by default is turned on.
If the width of Neovim is small enough, there is no way to draw the popup with the title and have it shown properly.
Check if the total popup width fits in the Neovim width and hide the title if it doesn't.
It is hard to make a release at the moment and to create the release notes and changelog.
Create a release pipeline which generates a release with release notes and a CHANGELOG
file.
When invoking rename
I get
E5108: Error executing lua ...imvu47Wx/usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:458: bad argument #2 to 'format' (number expected, got nil)
Steps to reproduce the behavior:
:lua require('renamer').rename()
and hit Enterbad argument #2 to 'format' (number expected, got nil)
errorThe rename dialog shows
Lsp Client: efm
There is no way to check the health of the plugin (if all dependencies are met).
Implement the health#renamer#check
to expose the :checkhealth <plugin>
call.
If the first row of a file is changed by rename, quickfix list is not properly set.
Steps to reproduce the behavior:
renamer
with qf list:copen
)The first row should be properly set.
If applicable, add screenshots to help explain your problem.
Add any other context about the problem here.
Cancelling rename()
from insert
mode puts cursor 1 character ahead.
Steps to reproduce the behavior:
renamer()
insert
mode keymap for calling renamer.rename()
renamer.rename()
using the keymapThe cursor should stay in the same position as it was when renamer.rename()
was called.
Only the build status for the develop
branch is shown in the README.md
. Since nightly Neovim releases sometimes fail and cannot be retrieved, there should also be a master
build status, to ensure users that the latest version works.
Add a badge for the master
build workflow status.
If the word to be renamed appears more than once in the line and is more towards the end of the line, the popup is offset in a weird way.
Steps to reproduce the behavior:
renamer
local maps = require 'maps'
)rename()
on the first occurenceThe popup should be placed below the word under the cursor.
The issue is from renamer._get_word_boundaries_in_line()
. The logic should be changed.
Currently, if the popup has not enough space to be drawn above or below the current line, its creation is undefined behaviour.
Throw an error if there is not enough space for the popup to be drawn, letting the user know why renaming failed. In order to make it possible to still rename, default to the basic vim.lsp.buf.rename()
functionality, instead of the popup.
plenary.nvim
's popup
has the option to set a custom highlight to the popup title. renamer.nvim
however does not provide this customization option.
Add a new highlight for the popup title.
Invoking rename
method will throw this error when you attempt it on empty space:
E5108: Error executing lua ~\.vim-plug\renamer.nvim/lua/renamer/init.lua:129: attempt to perform arithmetic on local 'word_start' (a nil value)
stack traceback:
~\.vim-plug\renamer.nvim/lua/renamer/init.lua:129: in function 'rename'
[string ":lua"]:1: in main chunk
Steps to reproduce the behavior:
lua require('renamer').rename()
.There should be short and less distracting message displayed instead.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.