summaryrefslogtreecommitdiffstats
path: root/runtime/autoload
diff options
context:
space:
mode:
authorChris Kipp <ckipp@pm.me>2022-12-14 16:42:15 +0000
committerBram Moolenaar <Bram@vim.org>2022-12-14 16:42:15 +0000
commit70ef3f546b6ef83e463e91b7e388d9c68ad58894 (patch)
treeb17dfe24750d8452e34b4483de767d780007ae2b /runtime/autoload
parenteb53350c02f620305e931ffd2ac611cc2b1a0ce9 (diff)
patch 9.0.1057: conflict between supercollider and scala filetype detectionv9.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)
Diffstat (limited to 'runtime/autoload')
-rw-r--r--runtime/autoload/dist/ft.vim7
1 files changed, 5 insertions, 2 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index e6f18617cd..6a3c5e14d6 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -810,10 +810,13 @@ export def SQL()
enddef
# This function checks the first 25 lines of file extension "sc" to resolve
-# detection between scala and SuperCollider
+# 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) =~# '[A-Za-z0-9]*\s:\s[A-Za-z0-9]\|var\s<\|classvar\s<\|\^this.*\||\w*|\|+\s\w*\s{\|\*ar\s'
+ if getline(lnum) =~# 'var\s<\|classvar\s<\|\^this.*\||\w\+|\|+\s\w*\s{\|\*ar\s'
setf supercollider
return
endif