Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with custom-elements-languageserver ("Nothing to rename") #44

Closed
Dioswilson opened this issue Nov 14, 2023 · 13 comments
Closed

Comments

@Dioswilson
Copy link

Hello, I am having issues making it work on lua files, I've tested it on C,C++ and java and it worked well, but when trying to use it on lua files it doesn't work.
I have this sudggeste mapping:

vim.keymap.set("n", "<leader>rn", function()
    return ":IncRename " .. vim.fn.expand("<cword>")
end, { expr = true, desc = "[R]e[n]ame" })

When trying to use it on lua files the dressing window appears for an instant and I get the following error: [inc_rename] Nothing to rename
Also if I try to use the command manually the command tries to trigger as soon asi I write :Inc with the E471: Argument required error

I tried with Lspsaga's rename and it works fine.
Lsp I use on Lua is stylua

@smjonas
Copy link
Owner

smjonas commented Nov 14, 2023

Hi, thanks for reporting. Can you send me the contents of the Lua file and let me know which symbol your cursor was on as you tried to rename? Thanks.

@Dioswilson
Copy link
Author

Dioswilson commented Nov 15, 2023

Sure, it happens on(almost) every lua file so can't rename this on a separate file(cursor is on top of "test"):

local test={"thing"}

test[1]="ABC"

I couldn't determine when It happens though, if I create a test.lua inside home dir it works fine, but on every project I create a lua file I have this issue

@Dioswilson
Copy link
Author

Ok, it seems to be working wrong with most of the filetypes when running under a project. When runnning in single file mode it works well . With java(jdtls) it doesn't thow any errors but it doesn't work, with C/C++(clangd) I get the same error and with python(pylsp) it works well

@Dioswilson Dioswilson changed the title Does not work on lua files Does not work on outside of "single file mode" Nov 17, 2023
@Dioswilson Dioswilson changed the title Does not work on outside of "single file mode" Does not work on outside of "single file mode" Nov 17, 2023
@smjonas
Copy link
Owner

smjonas commented Nov 17, 2023

Could you send me the link to a project where it does not work? Since I can't reproduce it right now (seems to work for both single file mode and within a project).

@Dioswilson
Copy link
Author

Here is my nvim- config, doesn't work there

@Dioswilson
Copy link
Author

Also just created a new project with only "test.lua" and .git directory, it first worked, then opened my config tried to rename something there, it didn't work, and the went to rename somthing in test.lua and it didn't work anymore

@smjonas
Copy link
Owner

smjonas commented Nov 17, 2023

That's strange, it works for me in your config:
image
What happens if you run := vim.lsp.buf.rename() instead of :IncRename?

@Dioswilson
Copy link
Author

Dioswilson commented Nov 17, 2023

Cannot test right now, but is project root the root directory of the project when you run :LspInfo ? For me issues ocurred when that happened

@smjonas
Copy link
Owner

smjonas commented Nov 17, 2023

Yes, LspInfo shows this:

 Client: lua_ls (id: 2, bufnr: [4])
 	filetypes:       lua
 	autostart:       true
 	root directory:  /home/<me>/Desktop/nvim-config/lua/
 	cmd:             /home/<me>/.local/share/nvim/mason/bin/lua-language-server

@Dioswilson
Copy link
Author

I will test when I get home with vim.lsp.buf.rename() and try to figure out if ant plugin is getting in the way. Also i did try with lspsaga's rename and it worked well

@Dioswilson
Copy link
Author

Update: executing := vim.lsp.buf.rename() works. I will try to figure out if another plugin is getting in the way

@Dioswilson
Copy link
Author

I found the issue. It happens whedn the custom-elements-languageserver LSP is intalled. I uninstalled it and it works fine

@smjonas
Copy link
Owner

smjonas commented Nov 19, 2023

Thanks a lot for investigating, I'm glad you figured it out!

@smjonas smjonas changed the title Does not work on outside of "single file mode" Incompatible with custom-elements-languageserver ("Nothing to rename") Dec 3, 2023
@smjonas smjonas closed this as completed Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants