Skip to content

Commit

Permalink
warning when using unsupported version of Neovim
Browse files Browse the repository at this point in the history
  • Loading branch information
bhcleek committed Sep 25, 2018
1 parent 5ec87ee commit bbc0649
Showing 1 changed file with 38 additions and 23 deletions.
61 changes: 38 additions & 23 deletions plugin/go.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,44 @@ if exists("g:go_loaded_install")
endif
let g:go_loaded_install = 1

" Not using the has('patch-7.4.2009') syntax because that wasn't added until
" 7.4.237, and we want to be sure this works for everyone (this is also why
" we're not using utils#EchoError()).
"
" Version 7.4.2009 was chosen because that's greater than what the most recent Ubuntu LTS
" release (16.04) uses and has a couple of features we need (e.g. execute()
" and :message clear).
if
\ go#config#VersionWarning() != 0 &&
\ (v:version < 704 || (v:version == 704 && !has('patch2009')))
\ && !has('nvim')
echohl Error
echom "vim-go requires Vim 7.4.2009 or Neovim, but you're using an older version."
echom "Please update your Vim for the best vim-go experience."
echom "If you really want to continue you can set this to make the error go away:"
echom " let g:go_version_warning = 0"
echom "Note that some features may error out or behave incorrectly."
echom "Please do not report bugs unless you're using Vim 7.4.2009 or newer."
echohl None

" Make sure people see this.
sleep 2
endif
function! s:checkVersion() abort
" Not using the has('patch-7.4.2009') syntax because that wasn't added until
" 7.4.237, and we want to be sure this works for everyone (this is also why
" we're not using utils#EchoError()).
"
" Version 7.4.2009 was chosen because that's greater than what the most recent Ubuntu LTS
" release (16.04) uses and has a couple of features we need (e.g. execute()
" and :message clear).

let l:unsupported = 0
if go#config#VersionWarning() != 0
if (v:version < 704 || (v:version == 704 && !has('patch2009')))
\ && !has('nvim')
let l:unsupported = 1
elseif has('nvim')
let l:version = api_info().version
if l:version.major != 0 || l:version.minor != 3 || l:version.minor != 1
let l:unsupported = 1
endif
endif
endif

if l:unsupported == 1
echohl Error
echom "vim-go requires Vim 7.4.2009 or Neovim 0.3.1, but you're using an older version."
echom "Please update your Vim for the best vim-go experience."
echom "If you really want to continue you can set this to make the error go away:"
echom " let g:go_version_warning = 0"
echom "Note that some features may error out or behave incorrectly."
echom "Please do not report bugs unless you're using Vim 7.4.2009 or newer or Neovim 0.3.1."
echohl None

" Make sure people see this.
sleep 2
endif
endfunction

call s:checkVersion()

" these packages are used by vim-go and can be automatically installed if
" needed by the user with GoInstallBinaries.
Expand Down

0 comments on commit bbc0649

Please sign in to comment.