]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1591: some "gomod" files are not recognized v9.0.1591
authorOmar El Halabi <omar.el.halabi@freiheit.com>
Mon, 29 May 2023 18:59:45 +0000 (19:59 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 29 May 2023 18:59:45 +0000 (19:59 +0100)
Problem:    Some "gomod" files are not recognized.
Solution:   Check for "go.mod" file name before checking out the contents.
            (Omar El Halabi, closes #12462)

runtime/autoload/dist/ft.vim
src/testdir/test_filetype.vim
src/version.c

index 7ac053eb2ffaa70d3e4eb10283a6c79d4453a784..770f7066c3e1864edc5960a40549082baf6c01e3 100644 (file)
@@ -484,14 +484,14 @@ enddef
 export def FTmod()
   if exists("g:filetype_mod")
     exe "setf " .. g:filetype_mod
+  elseif expand("<afile>") =~ '\<go.mod$'
+    setf gomod
   elseif IsLProlog()
     setf lprolog
   elseif getline(nextnonblank(1)) =~ '\%(\<MODULE\s\+\w\+\s*;\|^\s*(\*\)'
     setf modula2
   elseif IsRapid()
     setf rapid
-  elseif expand("<afile>") =~ '\<go.mod$'
-    setf gomod
   else
     # Nothing recognized, assume modsim3
     setf modsim3
index 96cb6868630ff3a2ba6a9e26c8278d43df918aee..0684383ee4e3d2ec59f75c7bcd16410321dc9a62 100644 (file)
@@ -1534,6 +1534,12 @@ func Test_mod_file()
   bwipe!
   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
 endfunc
 
index fbe684a5af7ff87fbb0032596ce4ad3182327498..ad1b686ea636eb1f323ba67534a80187105c78ad 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1591,
 /**/
     1590,
 /**/