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

guru: drop guru support #3650

Merged
merged 1 commit into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions autoload/go/config.vim
Original file line number Diff line number Diff line change
Expand Up @@ -137,32 +137,6 @@ function! go#config#ListAutoclose() abort
return get(g:, 'go_list_autoclose', 1)
endfunction

function! go#config#InfoMode() abort
return get(g:, 'go_info_mode', 'gopls')
endfunction

function! go#config#GuruScope() abort
let scope = get(g:, 'go_guru_scope', [])

if !empty(scope)
" strip trailing slashes for each path in scope. bug:
" https://github.com/golang/go/issues/14584
let scopes = go#util#StripTrailingSlash(scope)
endif

return scope
endfunction

function! go#config#SetGuruScope(scope) abort
if empty(a:scope)
if exists('g:go_guru_scope')
unlet g:go_guru_scope
endif
else
let g:go_guru_scope = a:scope
endif
endfunction

function! go#config#EchoCommandInfo() abort
return get(g:, 'go_echo_command_info', 1)
endfunction
Expand Down
45 changes: 1 addition & 44 deletions autoload/go/def.vim
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ let s:go_stack_level = 0
function! go#def#Jump(mode, type) abort
let l:fname = fnamemodify(expand("%"), ':p:gs?\\?/?')

" so guru right now is slow for some people. previously we were using
" godef which also has it's own quirks. But this issue come up so many
" times I've decided to support both. By default we still use guru as it
" covers all edge cases, but now anyone can switch to godef if they wish
let bin_name = go#config#DefMode()
if bin_name == 'godef'
let l:cmd = ['godef',
Expand All @@ -28,45 +24,6 @@ function! go#def#Jump(mode, type) abort
else
let [l:out, l:err] = go#util#ExecInDir(l:cmd)
endif
elseif bin_name == 'guru'
let cmd = [go#path#CheckBinPath(bin_name)]
let buildtags = go#config#BuildTags()
if buildtags isnot ''
let cmd += ['-tags', buildtags]
endif

let stdin_content = ""

if &modified
let content = join(go#util#GetLines(), "\n")
let stdin_content = fname . "\n" . strlen(content) . "\n" . content
call add(cmd, "-modified")
endif

call extend(cmd, ["definition", fname . ':#' . go#util#OffsetCursor()])

if go#util#has_job()
let l:state = {}
let l:spawn_args = {
\ 'cmd': cmd,
\ 'complete': function('s:jump_to_declaration_cb', [a:mode, bin_name], l:state),
\ 'for': '_',
\ 'statustype': 'searching declaration',
\ }

if &modified
let l:spawn_args.input = stdin_content
endif

call s:def_job(spawn_args, l:state)
return
endif

if &modified
let [l:out, l:err] = go#util#ExecInDir(l:cmd, l:stdin_content)
else
let [l:out, l:err] = go#util#ExecInDir(l:cmd)
endif
elseif bin_name == 'gopls'
if !go#config#GoplsEnabled()
call go#util#EchoError("go_def_mode is 'gopls', but gopls is disabled")
Expand All @@ -86,7 +43,7 @@ function! go#def#Jump(mode, type) abort
endif
return
else
call go#util#EchoError('go_def_mode value: '. bin_name .' is not valid. Valid values are: [godef, guru, gopls]')
call go#util#EchoError('go_def_mode value: '. bin_name .' is not valid. Valid values are: [godef, gopls]')
return
endif

Expand Down
21 changes: 0 additions & 21 deletions autoload/go/def_test.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@ set cpo&vim

scriptencoding utf-8

func! Test_jump_to_declaration_guru() abort
let l:wd = getcwd()
try
let g:go_gopls_enabled = 0
let l:filename = 'def/jump.go'
let l:lnum = 5
let l:col = 6
let l:tmp = gotest#load_fixture(l:filename)

let l:guru_out = printf("%s:%d:%d: defined here as func main", l:filename, l:lnum, l:col)
call go#def#jump_to_declaration(l:guru_out, "", 'guru')

call assert_equal(l:filename, bufname("%"))
call assert_equal(l:lnum, getcurpos()[1])
call assert_equal(l:col, getcurpos()[2])
finally
call go#util#Chdir(l:wd)
call delete(l:tmp, 'rf')
endtry
endfunc

func! Test_jump_to_declaration_godef() abort
let l:wd = getcwd()
try
Expand Down
Loading
Loading