changeset 32519:eae7e7217f26 v9.0.1591

patch 9.0.1591: some "gomod" files are not recognized Commit: https://github.com/vim/vim/commit/c9fbd2560f24180d2efa40028ed68427341d2d99 Author: Omar El Halabi <omar.el.halabi@freiheit.com> Date: Mon May 29 19:59:45 2023 +0100 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)
author Bram Moolenaar <Bram@vim.org>
date Mon, 29 May 2023 21:00:04 +0200
parents fee0b6216514
children e37e69174865
files runtime/autoload/dist/ft.vim src/testdir/test_filetype.vim src/version.c
diffstat 3 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -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
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -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
 
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1591,
+/**/
     1590,
 /**/
     1589,