zed-industries / extensions

Extensions for the Zed editor
631 stars 255 forks source link

Syntax recognition .conf #776

Closed Angelk90 closed 4 days ago

Angelk90 commented 1 month ago

Check for existing issues

Misc notes

Vscode:

Screenshot 2024-05-22 alle 22 01 05

Zed:

Screenshot 2024-05-22 alle 22 00 57
Angelk90 commented 1 month ago

Possible example of highlights.scm for a conf file.

; highlights.scm

; Define the highlight groups for the configuration file syntax

; Highlight keys (identifiers followed by an assignment operator)
((identifier) @variable
  ((match? @variable "^[a-zA-Z0-9_-]+$") @keyword))

; Highlight strings
((string_literal) @string
  ((match? @string "^\".*\"$") @string))

; Highlight integer numbers
((number_literal) @number
  ((match? @number "^[0-9]+$") @number))

; Highlight boolean values (true, false)
((identifier) @boolean
  ((match? @boolean "^(true|false)$") @boolean))

; Highlight the assignment operator
((operator) @operator
  ((match? @operator "^=$") @operator))

; Highlight comments (starting with ;)
((comment) @comment
  ((match? @comment "^;.*$") @comment))