Skip to content

Removing logic needed to support Vim 7.4 as it has been dropped. #2495

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

Merged
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
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ notifications:
email: false
matrix:
include:
- env: SCRIPT="test -c" VIM_VERSION=vim-7.4
- env: SCRIPT="test -c" VIM_VERSION=vim-8.0
- env: SCRIPT="test -c" VIM_VERSION=nvim
- env: ENV=vimlint SCRIPT=lint VIM_VERSION=vim-8.0
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ USER vim-go
COPY . /vim-go/
WORKDIR /vim-go

RUN scripts/install-vim vim-7.4
RUN scripts/install-vim vim-8.0
RUN scripts/install-vim nvim

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VIMS ?= vim-7.4 vim-8.0 nvim
VIMS ?= vim-8.0 nvim

all: install lint test

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This plugin adds Go language support for Vim, with the following main features:

## Install

vim-go requires at least Vim 7.4.2009 or Neovim 0.3.1.
vim-go requires at least Vim 8.0.1542 or Neovim 0.3.1.

The [**latest stable release**](https://github.com/fatih/vim-go/releases/latest) is the
recommended version to use. If you choose to use the master branch instead,
Expand Down
5 changes: 3 additions & 2 deletions autoload/go/cmd.vim
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function! go#cmd#Build(bang, ...) abort
\ map(copy(a:000), "expand(v:val)") +
\ [".", "errors"]

" Vim and Neovim async.
" Vim and Neovim async
if go#util#has_job()
call s:cmd_job({
\ 'cmd': ['go'] + args,
Expand All @@ -41,7 +41,7 @@ function! go#cmd#Build(bang, ...) abort
\ 'statustype': 'build'
\})

" Vim 7.4 without async
" Vim without async
else
let default_makeprg = &makeprg
let &makeprg = "go " . join(go#util#Shelllist(args), ' ')
Expand Down Expand Up @@ -72,6 +72,7 @@ function! go#cmd#Build(bang, ...) abort
call go#util#EchoSuccess("[build] SUCCESS")
endif
endif

endfunction


Expand Down
6 changes: 3 additions & 3 deletions autoload/go/coverage.vim
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ endfunction
" the code. Calling it again reruns the tests and shows the last updated
" coverage.
function! go#coverage#Buffer(bang, ...) abort
" we use matchaddpos() which was introduce with 7.4.330, be sure we have
" it: http://ftp.vim.org/vim/patches/7.4/7.4.330

" check if the version of Vim being tested supports matchaddpos()
if !exists("*matchaddpos")
call go#util#EchoError("GoCoverage is supported with Vim version 7.4-330 or later")
call go#util#EchoError("GoCoverage is not supported by your version of Vim.")
return -1
endif

Expand Down
15 changes: 4 additions & 11 deletions autoload/go/fmt.vim
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,11 @@ function! go#fmt#update_file(source, target)

let l:listtype = go#list#Type("GoFmt")

" the title information was introduced with 7.4-2200
" https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
if has('patch-7.4.2200')
" clean up previous list
if l:listtype == "quickfix"
let l:list_title = getqflist({'title': 1})
else
let l:list_title = getloclist(0, {'title': 1})
endif
" clean up previous list
if l:listtype == "quickfix"
let l:list_title = getqflist({'title': 1})
else
" can't check the title, so assume that the list was for go fmt.
let l:list_title = {'title': 'Format'}
let l:list_title = getloclist(0, {'title': 1})
endif

if has_key(l:list_title, "title") && l:list_title['title'] == "Format"
Expand Down
21 changes: 8 additions & 13 deletions autoload/go/guru.vim
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,10 @@ function! go#guru#Describe(selected) abort
endfunction

function! go#guru#DescribeInfo(showstatus) abort
" json_encode() and friends are introduced with this patch (7.4.1304)
" vim: https://groups.google.com/d/msg/vim_dev/vLupTNhQhZ8/cDGIk0JEDgAJ
" nvim: https://github.com/neovim/neovim/pull/4131

" check if the version of Vim being tested supports json_decode()
if !exists("*json_decode")
call go#util#EchoError("requires 'json_decode'. Update your Vim/Neovim version.")
call go#util#EchoError("GoDescribeInfo requires 'json_decode'. Update your Vim/Neovim version.")
return
endif

Expand Down Expand Up @@ -416,16 +415,14 @@ function! go#guru#Referrers(selected) abort
endfunction

function! go#guru#SameIds(showstatus) abort
" we use matchaddpos() which was introduce with 7.4.330, be sure we have
" it: http://ftp.vim.org/vim/patches/7.4/7.4.330

" check if the version of Vim being tested supports matchaddpos()
if !exists("*matchaddpos")
call go#util#EchoError("GoSameIds requires 'matchaddpos'. Update your Vim/Neovim version.")
return
endif

" json_encode() and friends are introduced with this patch (7.4.1304)
" vim: https://groups.google.com/d/msg/vim_dev/vLupTNhQhZ8/cDGIk0JEDgAJ
" nvim: https://github.com/neovim/neovim/pull/4131
" check if the version of Vim being tested supports json_decode()
if !exists("*json_decode")
call go#util#EchoError("GoSameIds requires 'json_decode'. Update your Vim/Neovim version.")
return
Expand Down Expand Up @@ -602,11 +599,9 @@ function! go#guru#DescribeBalloon() abort
return
endif

" json_encode() and friends are introduced with this patch (7.4.1304)
" vim: https://groups.google.com/d/msg/vim_dev/vLupTNhQhZ8/cDGIk0JEDgAJ
" nvim: https://github.com/neovim/neovim/pull/4131
" check if the version of Vim being tested supports json_decode()
if !exists("*json_decode")
call go#util#EchoError("requires 'json_decode'. Update your Vim/Neovim version.")
call go#util#EchoError("GoDescribeBalloon requires 'json_decode'. Update your Vim/Neovim version.")
return
endif

Expand Down
11 changes: 4 additions & 7 deletions autoload/go/list.vim
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,10 @@ endfunction
function! go#list#Populate(listtype, items, title) abort
if a:listtype == "locationlist"
call setloclist(0, a:items, 'r')

" The last argument ({what}) is introduced with 7.4.2200:
" https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
if has("patch-7.4.2200") | call setloclist(0, [], 'a', {'title': a:title}) | endif
call setloclist(0, [], 'a', {'title': a:title})
else
call setqflist(a:items, 'r')
if has("patch-7.4.2200") | call setqflist([], 'a', {'title': a:title}) | endif
call setqflist([], 'a', {'title': a:title})
endif
endfunction

Expand All @@ -80,10 +77,10 @@ endfunction
function! go#list#Parse(listtype, items, title) abort
if a:listtype == "locationlist"
lgetexpr a:items
if has("patch-7.4.2200") | call setloclist(0, [], 'a', {'title': a:title}) | endif
call setloclist(0, [], 'a', {'title': a:title})
else
cgetexpr a:items
if has("patch-7.4.2200") | call setqflist([], 'a', {'title': a:title}) | endif
call setqflist([], 'a', {'title': a:title})
endif
endfunction

Expand Down
15 changes: 4 additions & 11 deletions autoload/go/mod.vim
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,11 @@ function! go#mod#update_file(source, target)

let l:listtype = go#list#Type("GoModFmt")

" the title information was introduced with 7.4-2200
" https://github.com/vim/vim/commit/d823fa910cca43fec3c31c030ee908a14c272640
if has('patch-7.4.2200')
" clean up previous list
if l:listtype == "quickfix"
let l:list_title = getqflist({'title': 1})
else
let l:list_title = getloclist(0, {'title': 1})
endif
" clean up previous list
if l:listtype == "quickfix"
let l:list_title = getqflist({'title': 1})
else
" can't check the title, so assume that the list was for go fmt.
let l:list_title = {'title': 'Format'}
let l:list_title = getloclist(0, {'title': 1})
endif

if has_key(l:list_title, "title") && l:list_title['title'] == "Format"
Expand Down
6 changes: 3 additions & 3 deletions doc/vim-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ experience.
==============================================================================
INSTALL *go-install*

vim-go requires at least Vim 7.4.2009 or Neovim 0.3.1. On macOS, if you are
vim-go requires at least Vim 8.0.1542 or Neovim 0.3.2. On macOS, if you are
still using your system version of vim, you can use homebrew to keep your
version of Vim up-to-date with the following terminal command:
>
Expand Down Expand Up @@ -1202,7 +1202,7 @@ for Vim8 and Neovim.
*go#complete#GocodeComplete()*

Uses `gocode` for autocompletion. By default, it is hooked up to |'omnifunc'|
for Vim 7.4.
for Vim 8+.

*go#tool#DescribeBalloon()*

Expand Down Expand Up @@ -2427,7 +2427,7 @@ To run tests vim-go comes with three small helper scripts:
`scripts/test` Run all tests with a Vim from `/tmp/vim-go-test/`.

All scripts accept a Vim version as the first argument, which can be
`vim-7.4`, `vim-8.0`, or `nvim`. You will need to install a Vim version with
`vim-8.0` or `nvim`. You will need to install a Vim version with
`install-vim` before you can use `run-vim` or `test`.

You can install and test all Vim versions by running `make`.
Expand Down
14 changes: 3 additions & 11 deletions plugin/go.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,22 @@ let s:cpo_save = &cpo
set cpo&vim

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 has('nvim')
let l:unsupported = !has('nvim-0.3.2')
else
let l:unsupported = (v:version < 704 || (v:version == 704 && !has('patch2009')))
let l:unsupported = v:version < 800
endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking for just "Vim 8" isn't really enough, since it spans almost 2 years of development. You should pick a specific patch version like it did previously.

In the documentation above 8.0.1542 was chosen; why that version? The previous policy was always "what the latest Ubuntu LTS has", which is now Vim 8.0.1453 (18.04).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see now that you probably choose 8.0.1542 because that's in the Travis file? It has no special meaning, it just happened to be the version installed on my Arch laptop when I wrote that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We needed to pick something, and Vim8 is sufficient for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So will Vim 8,0.0001 work? Probably not, since: https://github.com/fatih/vim-go/search?q=patch-8.0&unscoped_q=patch-8.0

These patch checks should probably also be removed, by the way. I don't know why it's such a fight to get all these details right every time... It's not even harder or anything 🤷‍♂️

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking here is that previously vim-go checked that it was at least Vim 7.4.2009. All we're doing is dropping support for Vim 7.4. Another patch to make sure it's at least 8.0.1453 makes sense. I'll add that later and probably drop the unneeded patch checks at the same time (if you're not motivated to submit it first), but didn't see any need to hold up the improvements that @rbisewski made.


if l:unsupported == 1
echohl Error
echom "vim-go requires Vim 7.4.2009 or Neovim 0.3.2, but you're using an older version."
echom "vim-go requires Vim 8+ or Neovim 0.3.2, 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.2."
echom "Please do not report bugs unless you're using Vim 8+ or Neovim 0.3.2."
echohl None

" Make sure people see this.
Expand Down
2 changes: 1 addition & 1 deletion scripts/bench-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cd "$vimgodir"

if [ -z "${1:-}" ]; then
echo "unknown version: '${1:-}'"
echo "First argument must be 'vim-7.4', 'vim-8.0', or 'nvim'."
echo "First argument must be 'vim-8.0' or 'nvim'."
exit 1
fi

Expand Down
7 changes: 1 addition & 6 deletions scripts/install-vim
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ cd "$vimgodir"
vim=${1:-}

case "$vim" in
"vim-7.4")
tag="v7.4.2009"
giturl="https://github.com/vim/vim"
;;

"vim-8.0")
# This follows the version in Arch Linux. Vim's master branch isn't always
# stable, and we don't want to have the build fail because Vim introduced a
Expand All @@ -36,7 +31,7 @@ case "$vim" in

*)
echo "unknown version: '${1:-}'"
echo "First argument must be 'vim-7.4', 'vim-8.0', or 'nvim'."
echo "First argument must be 'vim-8.0' or 'nvim'."
exit 1
;;
esac
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cd "$vimgodir"
#####################################
if [ -z "${1:-}" ]; then
echo "unknown version: '${1:-}'"
echo "First argument must be 'vim-7.4', 'vim-8.0', or 'nvim'."
echo "First argument must be 'vim-8.0' or 'nvim'."
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion scripts/run-vim
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ shift $((OPTIND - 1))

if [ -z "${1:-}" ]; then
echo "unknown version: '${1:-}'"
echo "First argument must be 'vim-7.4', 'vim-8.0', or 'nvim'."
echo "First argument must be 'vim-8.0' or 'nvim'."
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ shift $((OPTIND - 1))
#####################################
if [ -z "${1:-}" ]; then
echo "unknown version: '${1:-}'"
echo "First argument must be 'vim-7.4', 'vim-8.0', or 'nvim'."
echo "First argument must be 'vim-8.0' or 'nvim'."
exit 1
fi

Expand Down