Unnamed repository; edit this file 'description' to name the repository.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Zed OneDark
# Author : EricHenry

"attribute" = { fg = "yellow" }
"comment" = { fg = "light-gray", modifiers = ["italic"] }
"constant" = { fg = "yellow" }
"constant.numeric" = { fg = "orange" }
"constant.builtin" = { fg = "yellow" }
"constant.builtin.boolean" = { fg = "yellow" }
"constant.character.escape" = { fg = "yellow" }
"constructor" = { fg = "blue" }
"function" = { fg = "blue" }
"function.builtin" = { fg = "blue" }
"function.method" = { fg = "blue" }
"function.macro" = { fg = "blue" }
"keyword" = { fg = "purple" }
"label" = { fg = "ui-text" }
"namespace" = { fg = "ui-text" }
"operator" = { fg = "ui-text" }
"puncuation" = { fg = "ui-text" }
"special" = { fg = "ui-text" }
"string" = { fg = "green" }
"type" = { fg = "cyan" }
"variable.builtin" = { fg = "orange" }
"variable.parameter" = { fg = "ui-text" }
"variable.other.member" = { fg = "red" }

"markup.heading" = { fg = "red" }
"markup.raw.inline" = { fg = "green" }
"markup.bold" = { fg = "yellow", modifiers = ["bold"] }
"markup.italic" = { fg = "purple", modifiers = ["italic"] }
"markup.strikethrough" = { modifiers = ["crossed_out"] }
"markup.list" = { fg = "red" }
"markup.quote" = { fg = "yellow" }
"markup.link.url" = { fg = "cyan", modifiers = ["underlined"] }
"markup.link.text" = { fg = "purple" }

"diff.plus" = "green"
"diff.delta" = "yellow"
"diff.minus" = "red"

"diagnostic.info".underline = { color = "blue", style = "curl" }
"diagnostic.hint".underline = { color = "green", style = "curl" }
"diagnostic.warning".underline = { color = "yellow", style = "curl" }
"diagnostic.error".underline = { color = "red", style = "curl" }
"diagnostic.unnecessary" = { modifiers = ["dim"] }
"diagnostic.deprecated" = { modifiers = ["crossed_out"] }
"info" = { fg = "blue", modifiers = ["bold"] }
"hint" = { fg = "green", modifiers = ["bold"] }
"warning" = { fg = "yellow", modifiers = ["bold"] }
"error" = { fg = "red", modifiers = ["bold"] }

"ui.background" = { bg = "ui-text-reversed" }
"ui.gutter" = { bg = "gray" }
"ui.virtual" = { fg = "faint-gray" }
"ui.virtual.indent-guide" = { fg = "faint-gray" }
"ui.virtual.whitespace" = { fg = "light-gray" }
"ui.virtual.ruler" = { bg = "gray" }
"ui.virtual.inlay-hint" = { fg = "blue-gray", modifiers = ["bold"] }

"ui.cursor" = { fg = "white", modifiers = ["reversed"] }
"ui.cursor.primary" = { fg = "white", modifiers = ["reversed"] }
"ui.cursor.match" = { fg = "blue", modifiers = ["underlined"] }
# Malformed ANSI: dark-blue. See 'https://github.com/helix-editor/helix/issues/5709'
# "ui.cursor.insert" = { fg = "dark-blue" }

"ui.selection" = { bg = "faint-gray" }
"ui.selection.primary" = { bg = "#293b5bff" }
"ui.cursorline.primary" = { bg = "gray" }

"ui.highlight" = { bg = "gray" }
"ui.highlight.frameline" = { bg = "#97202a" }

"ui.linenr" = { fg = "linenr" }
"ui.linenr.selected" = { fg = "ui-text" }

"ui.statusline" = { fg = "white", bg = "gray" }
"ui.statusline.inactive" = { fg = "light-gray", bg = "black" }
"ui.statusline.normal" = { fg = "black", bg = "blue" }
"ui.statusline.insert" = { fg = "black", bg = "green" }
"ui.statusline.select" = { fg = "black", bg = "purple" }

"ui.text" = { fg = "ui-text" }
"ui.text.focus" = { fg = "white", bg = "gray", modifiers = ["bold"] }

"ui.help" = { fg = "white", bg = "gray" }
"ui.popup" = { bg = "gray" }
"ui.window" = { fg = "gray" }
"ui.menu" = { fg = "ui-text", bg = "gray" }
"ui.menu.selected" = { fg = "ui-text-reversed", bg = "blue" }
"ui.menu.scroll" = { fg = "ui-text", bg = "light-gray" }

"ui.debug" = { fg = "red" }

[palette]
yellow = "#dfc184ff"
orange = "#bf956aff"
blue = "#73ade9ff"
blue-gray = "#5a6f89ff"
red = "#d07277ff"
purple = "#b477cfff"
green = "#a1c181ff"
cyan = "#6eb4bfff"
gray = "#2f343ebf"
light-gray = "#5d636fff"
faint-gray = "#3B4048"
linenr = "#5d636fff"

white = "#c8ccd4ff"
black = "#282c33ff"
# black and white are used for a lot of the UI text
ui-text = "#c8ccd4ff"          #white
ui-text-reversed = "#282c33ff" #black
yle: italic } /* Literal.String.Doc */ .highlight .s2 { color: #D5FF80 } /* Literal.String.Double */ .highlight .se { color: #D5FF80 } /* Literal.String.Escape */ .highlight .sh { color: #D5FF80 } /* Literal.String.Heredoc */ .highlight .si { color: #D5FF80 } /* Literal.String.Interpol */ .highlight .sx { color: #D5FF80 } /* Literal.String.Other */ .highlight .sr { color: #95E6CB } /* Literal.String.Regex */ .highlight .s1 { color: #D5FF80 } /* Literal.String.Single */ .highlight .ss { color: #D5FF80 } /* Literal.String.Symbol */ .highlight .bp { color: #F28779 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #FFD173 } /* Name.Function.Magic */ .highlight .vi { color: #FFCC66 } /* Name.Variable.Instance */ .highlight .vm { color: #5CCFE6; font-style: italic } /* Name.Variable.Magic */ .highlight .il { color: #DFBFFF } /* Literal.Number.Integer.Long */

Adding Indent Queries

Helix uses tree-sitter to correctly indent new lines. This requires a tree-sitter grammar and an indent.scm query file placed in runtime/queries/{language}/indents.scm. The indentation for a line is calculated by traversing the syntax tree from the lowest node at the beginning of the new line. Each of these nodes contributes to the total indent when it is captured by the query (in what way depends on the name of the capture).

Note that it matters where these added indents begin. For example, multiple indent level increases that start on the same line only increase the total indent level by 1.

Scopes

Added indents don't always apply to the whole node. For example, in most cases when a node should be indented, we actually only want everything except for its first line to be indented. For this, there are several scopes (more scopes may be added in the future if required):

Every capture type has a default scope which should do the right thing in most situations. When a different scope is required, this can be changed by using a #set! declaration anywhere in the pattern:

(assignment_expression
  right: (_) @indent
  (#set! "scope" "all"))

Capture Types

Predicates

In some cases, an S-expression cannot express exactly what pattern should be matched. For that, tree-sitter allows for predicates to appear anywhere within a pattern, similar to how #set! declarations work:

(some_kind
  (child_kind) @indent
  (#predicate? arg1 arg2 ...)
)

The number of arguments depends on the predicate that's used. Each argument is either a capture (@name) or a string ("some string"). The following predicates are supported by tree-sitter:

Additionally, we support some custom predicates for indent queries: