Skip to content

Commit

Permalink
Improve syntax highlighting for configuration files
Browse files Browse the repository at this point in the history
  • Loading branch information
xyproto committed Oct 11, 2024
1 parent f30479b commit 4a2ff93
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion v2/highlight.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,13 @@ func (e *Editor) WriteLines(c *vt100.Canvas, fromline, toline LineIndex, cx, cy
// Regular highlight
coloredString = unEscapeFunction(tout.DarkTags(string(textWithTags)))
}
case mode.Config, mode.CMake, mode.JSON:
case mode.Config, mode.CMake, mode.JSON, mode.Ini:
if !strings.HasPrefix(trimmedLine, singleLineCommentMarker) && (strings.Contains(trimmedLine, "/*") || strings.HasSuffix(trimmedLine, "*/")) {
// No highlight
coloredString = line
} else if (e.mode == mode.Ini || e.mode == mode.Config) && strings.HasPrefix(trimmedLine, ";") {
// Commented out
coloredString = unEscapeFunction(e.MultiLineComment.Start(line))
} else if strings.HasPrefix(trimmedLine, "> ") {
// If there is a } underneath and typing }, don't dedent, keep it at the same level!
coloredString = unEscapeFunction(e.MultiLineString.Start(trimmedLine))
Expand Down

0 comments on commit 4a2ff93

Please sign in to comment.