Remove detect requirement and detect in jinja file

Ref #1415
This commit is contained in:
Zachary Yedidia
2019-12-28 22:27:44 -05:00
parent 4b0348f64a
commit bd83c6a8a9
5 changed files with 19 additions and 19 deletions

View File

@@ -532,18 +532,29 @@ func (b *Buffer) UpdateRules() {
}
}
// TODO: includes
if b.SyntaxDef != nil && highlight.HasIncludes(b.SyntaxDef) {
includes := highlight.GetIncludes(b.SyntaxDef)
var files []*highlight.File
for _, f := range config.ListRuntimeFiles(config.RTSyntax) {
data, _ := f.Data()
header, _ := highlight.MakeHeaderYaml(data)
data, err := f.Data()
if err != nil {
screen.TermMessage("Error parsing syntax file " + f.Name() + ": " + err.Error())
continue
}
header, err := highlight.MakeHeaderYaml(data)
if err != nil {
screen.TermMessage("Error parsing syntax file " + f.Name() + ": " + err.Error())
continue
}
for _, i := range includes {
if header.FileType == i {
file, _ := highlight.ParseFile(data)
file, err := highlight.ParseFile(data)
if err != nil {
screen.TermMessage("Error parsing syntax file " + f.Name() + ": " + err.Error())
continue
}
files = append(files, file)
break
}