patch 9.0.1591: some "gomod" files are not recognized
Problem: Some "gomod" files are not recognized.
Solution: Check for "go.mod" file name before checking out the contents.
(Omar El Halabi, closes #12462)
This commit is contained in:
committed by
Bram Moolenaar
parent
247caa378f
commit
c9fbd2560f
4
runtime/autoload/dist/ft.vim
vendored
4
runtime/autoload/dist/ft.vim
vendored
@ -484,14 +484,14 @@ enddef
|
|||||||
export def FTmod()
|
export def FTmod()
|
||||||
if exists("g:filetype_mod")
|
if exists("g:filetype_mod")
|
||||||
exe "setf " .. g:filetype_mod
|
exe "setf " .. g:filetype_mod
|
||||||
|
elseif expand("<afile>") =~ '\<go.mod$'
|
||||||
|
setf gomod
|
||||||
elseif IsLProlog()
|
elseif IsLProlog()
|
||||||
setf lprolog
|
setf lprolog
|
||||||
elseif getline(nextnonblank(1)) =~ '\%(\<MODULE\s\+\w\+\s*;\|^\s*(\*\)'
|
elseif getline(nextnonblank(1)) =~ '\%(\<MODULE\s\+\w\+\s*;\|^\s*(\*\)'
|
||||||
setf modula2
|
setf modula2
|
||||||
elseif IsRapid()
|
elseif IsRapid()
|
||||||
setf rapid
|
setf rapid
|
||||||
elseif expand("<afile>") =~ '\<go.mod$'
|
|
||||||
setf gomod
|
|
||||||
else
|
else
|
||||||
# Nothing recognized, assume modsim3
|
# Nothing recognized, assume modsim3
|
||||||
setf modsim3
|
setf modsim3
|
||||||
|
|||||||
@ -1534,6 +1534,12 @@ func Test_mod_file()
|
|||||||
bwipe!
|
bwipe!
|
||||||
call delete('go.mod')
|
call delete('go.mod')
|
||||||
|
|
||||||
|
call writefile(['module M'], 'go.mod')
|
||||||
|
split go.mod
|
||||||
|
call assert_equal('gomod', &filetype)
|
||||||
|
bwipe!
|
||||||
|
call delete('go.mod')
|
||||||
|
|
||||||
filetype off
|
filetype off
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
|||||||
@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1591,
|
||||||
/**/
|
/**/
|
||||||
1590,
|
1590,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user