To: vim_dev@googlegroups.com Subject: Patch 9.0.1057 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1057 Problem: Conflict between supercollider and scala filetype detection. Solution: Do not check for "Class : Method", it can appear in both filetypes. (Chris Kipp, closes #11699) Files: runtime/autoload/dist/ft.vim, src/testdir/test_filetype.vim *** ../vim-9.0.1056/runtime/autoload/dist/ft.vim 2022-11-24 10:58:07.659390137 +0000 --- runtime/autoload/dist/ft.vim 2022-12-14 16:40:22.822722276 +0000 *************** *** 810,819 **** enddef # This function checks the first 25 lines of file extension "sc" to resolve ! # detection between scala and SuperCollider export def FTsc() for lnum in range(1, min([line("$"), 25])) ! if getline(lnum) =~# '[A-Za-z0-9]*\s:\s[A-Za-z0-9]\|var\s<\|classvar\s<\|\^this.*\||\w*|\|+\s\w*\s{\|\*ar\s' setf supercollider return endif --- 810,822 ---- enddef # This function checks the first 25 lines of file extension "sc" to resolve ! # detection between scala and SuperCollider. ! # NOTE: We don't check for 'Class : Method', as this can easily be confused ! # with valid Scala like `val x : Int = 3`. So we instead only rely on ! # checks that can't be confused. export def FTsc() for lnum in range(1, min([line("$"), 25])) ! if getline(lnum) =~# 'var\s<\|classvar\s<\|\^this.*\||\w\+|\|+\s\w*\s{\|\*ar\s' setf supercollider return endif *** ../vim-9.0.1056/src/testdir/test_filetype.vim 2022-12-05 21:40:33.155131915 +0000 --- src/testdir/test_filetype.vim 2022-12-14 16:35:59.582665787 +0000 *************** *** 1533,1545 **** func Test_sc_file() filetype on - " SC file methods are defined 'Class : Method' - call writefile(['SCNvimDocRenderer : SCDocHTMLRenderer {'], 'srcfile.sc') - split srcfile.sc - call assert_equal('supercollider', &filetype) - bwipe! - call delete('srcfile.sc') - " SC classes are defined with '+ Class {}' call writefile(['+ SCNvim {', '*methodArgs {|method|'], 'srcfile.sc') split srcfile.sc --- 1533,1538 ---- *** ../vim-9.0.1056/src/version.c 2022-12-14 15:06:07.061956386 +0000 --- src/version.c 2022-12-14 16:38:48.442697619 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1057, /**/ -- FATHER: One day, lad, all this will be yours ... PRINCE: What - the curtains? "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///