hedyhli / outline.nvim

Code outline sidebar powered by LSP. Significantly enhanced & refactored fork of symbols-outline.nvim.
https://sr.ht/~hedy/outline.nvim
MIT License
543 stars 15 forks source link

Can't rename method under golang #42

Closed orbatschow closed 7 months ago

orbatschow commented 8 months ago

Using the code below as an example, renaming foo works as expected, but trying to rename Bar changing just the Bar part of the input text does nothing.

package main

type foo struct{}

func (*foo) Bar() {
}

func main() {
    _ = foo{}
}

Deleting the input text (i.e. removing the trailing (*foo).) works.

Versions:

nvim: v0.9.4 outline: rev https://github.com/hedyhli/outline.nvim/commit/d073791 gopls: v0.14.2

old issue: https://github.com/simrat39/symbols-outline.nvim/issues/175#issue-1390777725

hedyhli commented 7 months ago

The issue is due to handling the LSP rename ourselves in a naive approach, so we can handle blacklisted LSP clients from the config effectively. In nvim 0.8 vim.lsp.buf.rename added the ability to filter clients, so we can now delegate this task to the native API instead, which handles the rename for golang methods correctly.

https://github.com/hedyhli/outline.nvim/assets/50042066/b0fefa26-ccff-4a7a-a4e8-c34adfbfc432

This should now work with nvim 0.8+; the commit will be live soon.

Do let me know if it's still an issue.

orbatschow commented 7 months ago

confirmed working, thanks alot!