]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0557: filetype: Kawasaki Robots files are not recognized v9.2.0557
authorKnoP-01 <knosowski@graeffrobotics.de>
Fri, 29 May 2026 17:46:36 +0000 (17:46 +0000)
committerChristian Brabandt <cb@256bit.org>
Fri, 29 May 2026 17:54:57 +0000 (17:54 +0000)
Problem:  filetype: Kawasaki Robots files are not recognized
Solution: Detect *.pg as kawasaki_as filetype, add filetype detection
          for *.as as atlas or kawasaki_as filetype (KnoP-01).

In Kawasaki robots (https://kawasakirobotics.com/products-robots/)
AS language

*.pg is the extention for a program file and
*.as is for a complete backup.

closes: #20370

Signed-off-by: KnoP-01 <knosowski@graeffrobotics.de>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/autoload/dist/ft.vim
runtime/doc/filetype.txt
runtime/filetype.vim
src/testdir/test_filetype.vim
src/version.c

index 3b585b61d238199134ed03932239719483c8ee93..9419cf58a50d42d9fed5a4cc38071f30efc73142 100644 (file)
@@ -3,7 +3,7 @@ vim9script
 # Vim functions for file type detection
 #
 # Maintainer:          The Vim Project <https://github.com/vim/vim>
-# Last Change:         2026 May 28
+# Last Change:         2026 May 29
 # Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 # These functions are moved here from runtime/filetype.vim to make startup
@@ -63,6 +63,21 @@ export def FTapp()
   endfor
 enddef
 
+# This function checks for Kawasaki robots AS file or atlas file type.
+export def FTas()
+  if exists("g:filetype_as")
+    exe "setf " .. g:filetype_as
+    return
+  endif
+  for lnum in range(1, min([line("$"), 30]))
+    if getline(lnum) =~ '^\.NETCONF'
+      setf kawasaki_as
+      return
+    endif
+  endfor
+  setf atlas
+enddef
+
 # This function checks for the kind of assembly that is wanted by the user, or
 # can be detected from the beginning of the file.
 export def FTasm()
@@ -1771,7 +1786,6 @@ const ft_from_ext = {
   "astro": "astro",
   # Atlas
   "atl": "atlas",
-  "as": "atlas",
   # Atom is based on XML
   "atom": "xml",
   # Authzed
@@ -2300,6 +2314,8 @@ const ft_from_ext = {
   # KAREL
   "kl": "karel",
   "KL": "karel",
+  # Kawasaki AS
+  "pg": "kawasaki_as",
   # KDL
   "kdl": "kdl",
   # KerML
index 5078913e676ad39a183adafe6a6e8bf5b9a9e0ce..80c3bb810f9cb5c527e374e4661df0f176874396 100644 (file)
@@ -1,4 +1,4 @@
-*filetype.txt* For Vim version 9.2.  Last change: 2026 May 16
+*filetype.txt* For Vim version 9.2.  Last change: 2026 May 29
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -139,6 +139,7 @@ variables can be used to overrule the filetype used for certain extensions:
 
        file name       variable ~
        *.app           g:filetype_app
+       *.as            g:filetype_as
        *.asa           g:filetype_asa          |ft-aspperl-syntax|
                                                |ft-aspvbs-syntax|
        *.asm           g:asmsyntax             |ft-asm-syntax|
index da632acc54f224ae2c115a79032630000a1fde9a..3590ebe97c6dcdd6aece2539534069c434db300d 100644 (file)
@@ -1,7 +1,7 @@
 " Vim support file to detect file types
 "
 " Maintainer:          The Vim Project <https://github.com/vim/vim>
-" Last Change:         2026 Apr 20
+" Last Change:         2026 May 29
 " Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 " If the filetype can be detected from extension or file name(the final path component),
@@ -91,6 +91,9 @@ au BufNewFile,BufRead */.aptitude/config       setf aptconf
 " Arch Inventory file
 au BufNewFile,BufRead .arch-inventory,=tagging-method  setf arch
 
+" atlas or kawasaki_as
+au BufNewFile,BufRead *.as call dist#ft#FTas()
+
 " Active Server Pages (with Visual Basic Script)
 au BufNewFile,BufRead *.asa
        \ if exists("g:filetype_asa") |
index aefdef1b57aba301c5a70913ac4c4ed51fbb33de..5eb08f277d332f986e4abe63763e01c7abece074 100644 (file)
@@ -434,6 +434,7 @@ def s:GetFilenameChecks(): dict<list<string>>
     julia: ['file.jl'],
     just: ['justfile', 'Justfile', '.justfile', 'config.just'],
     karel: ['file.kl', 'file.KL'],
+    kawasaki_as: ['file.pg'],
     kconfig: ['Kconfig', 'Kconfig.debug', 'Kconfig.file', 'Config.in', 'Config.in.host'],
     kdl: ['file.kdl'],
     kerml: ['file.kerml'],
@@ -3540,4 +3541,19 @@ func Test_cucumber_code_injection()
   filetype plugin off
 endfunc
 
+func Test_as_file()
+  filetype on
+
+  call writefile([], 'Xfile.as', 'D')
+  split Xfile.as
+  call assert_equal('atlas', &filetype)
+  bwipe!
+  call writefile(['', '.NETCONF'], 'Xfile.as', 'D')
+  split Xfile.as
+  call assert_equal('kawasaki_as', &filetype)
+  bwipe!
+
+  filetype off
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index d17b4d586871e8c93b833509f2f5277ffd5f3ab3..685887351a838a3d21d868067f46cd21cd773ef0 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    557,
 /**/
     556,
 /**/