Skip to content

Commit a436dae

Browse files
committed
UpdateRules: allow includes in default.yaml
1 parent 5610d01 commit a436dae

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

internal/buffer/buffer.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,17 @@ func (b *Buffer) UpdateRules() {
911911
b.SyntaxDef = findRuntimeSyntaxDef(syntaxFile, header)
912912
}
913913

914+
if b.SyntaxDef != nil {
915+
b.Settings["filetype"] = b.SyntaxDef.FileType
916+
} else {
917+
// search for the default file in the user's custom syntax files
918+
b.SyntaxDef = findRealRuntimeSyntaxDef("default", nil)
919+
if b.SyntaxDef == nil {
920+
// search for the default file in the runtime files
921+
b.SyntaxDef = findRuntimeSyntaxDef("default", nil)
922+
}
923+
}
924+
914925
if b.SyntaxDef != nil && highlight.HasIncludes(b.SyntaxDef) {
915926
includes := highlight.GetIncludes(b.SyntaxDef)
916927

@@ -947,17 +958,6 @@ func (b *Buffer) UpdateRules() {
947958
highlight.ResolveIncludes(b.SyntaxDef, files)
948959
}
949960

950-
if b.SyntaxDef != nil {
951-
b.Settings["filetype"] = b.SyntaxDef.FileType
952-
} else {
953-
// search for the default file in the user's custom syntax files
954-
b.SyntaxDef = findRealRuntimeSyntaxDef("default", nil)
955-
if b.SyntaxDef == nil {
956-
// search for the default file in the runtime files
957-
b.SyntaxDef = findRuntimeSyntaxDef("default", nil)
958-
}
959-
}
960-
961961
if b.SyntaxDef != nil {
962962
b.Highlighter = highlight.NewHighlighter(b.SyntaxDef)
963963
if b.Settings["syntax"].(bool) {

0 commit comments

Comments
 (0)