Skip to content

Commit

Permalink
UpdateRules: add TODOs
Browse files Browse the repository at this point in the history
This logic turns out to be even more messy and buggy than it seems.
  • Loading branch information
dmaluka committed Apr 18, 2024
1 parent 3aed20f commit eb81277
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/buffer/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ func parseDefFromFile(f config.RuntimeFile, header *highlight.Header) *highlight
}

if header == nil {
// TODO: use faster highlight.MakeHeader() when possible
header, err = highlight.MakeHeaderYaml(data)
if err != nil {
screen.TermMessage("Error parsing header for syntax file " + f.Name() + ": " + err.Error())
Expand Down Expand Up @@ -926,6 +927,7 @@ func (b *Buffer) UpdateRules() {
includes := highlight.GetIncludes(b.SyntaxDef)

var files []*highlight.File
// TODO: search in the user's custom syntax files first
for _, f := range config.ListRuntimeFiles(config.RTSyntax) {
data, err := f.Data()
if err != nil {
Expand All @@ -950,6 +952,8 @@ func (b *Buffer) UpdateRules() {
break
}
}
// TODO: fix this mess. For each include, we should include
// exactly one file: either a built-in one or a user's custom one
if len(files) >= len(includes) {
break
}
Expand Down

0 comments on commit eb81277

Please sign in to comment.