Skip to content

Commit

Permalink
rename: add support for gopls rename
Browse files Browse the repository at this point in the history
  • Loading branch information
bhcleek committed Dec 26, 2024
1 parent 2ac4738 commit 95f62e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion autoload/go/rename.vim
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function! go#rename#Rename(bang, ...) abort
let l:bin = go#config#RenameCommand()

" return with a warning if the bin doesn't exist
let bin_path = go#path#CheckBinPath(l:bin)
let bin_path = go#path#CheckBinPath(substitute(l:bin, 'gopls rename$', 'gopls', ''))
if empty(bin_path)
return
endif
Expand All @@ -40,6 +40,8 @@ function! go#rename#Rename(bang, ...) abort
let args = []
if l:bin == 'gorename'
let l:args = extend(l:args, ['-tags', go#config#BuildTags(), '-offset', offset, '-to', to_identifier])
else if l:bin == 'gopls rename'
let l:args = extend(l:args, ['rename', offset, to_identifier])
else
call go#util#EchoWarning('unexpected rename command')
endif
Expand Down
2 changes: 1 addition & 1 deletion doc/vim-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1676,7 +1676,7 @@ default it is set to edit.
*'g:go_rename_command'*

Use this option to define which tool is used to rename. By default `gopls`
is used. Valid options are `gorename` and `gopls`.
is used. Valid options are `gopls`, `gopls rename`, and `gorename`.
>
let g:go_rename_command = 'gopls'
<
Expand Down

0 comments on commit 95f62e6

Please sign in to comment.