From 19926d95fe5e08b78ec6225f1cba8354de2bf9ce Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Thu, 22 Jun 2017 10:42:06 -0400 Subject: [PATCH] Throw error if there is no detect regex Closes #712 --- cmd/micro/highlight/parser.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/micro/highlight/parser.go b/cmd/micro/highlight/parser.go index 8e0a2897..996cef58 100644 --- a/cmd/micro/highlight/parser.go +++ b/cmd/micro/highlight/parser.go @@ -1,6 +1,7 @@ package highlight import ( + "errors" "fmt" "regexp" @@ -122,6 +123,10 @@ func ParseFtDetect(file *File) (r [2]*regexp.Regexp, err error) { } } + if loaded == 0 { + return r, errors.New("No detect regexes found") + } + return r, err }