mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 11:06:54 -04:00
use indent.X syntax for captures and properties of set directives
update CONTRIBUTING.md adjust indents for bass fix doc capture comment
This commit is contained in:
parent
b4fcc61175
commit
cb568af539
80 changed files with 592 additions and 575 deletions
|
|
@ -315,14 +315,14 @@ the node describing the language and `@content` to describe the injection region
|
|||
### Indents
|
||||
|
||||
```scheme
|
||||
@indent ; indent children when matching this node
|
||||
@indent_end ; marks the end of indented block
|
||||
@aligned_indent ; behaves like python aligned/hanging indent
|
||||
@dedent ; dedent children when matching this node
|
||||
@branch ; dedent itself when matching this node
|
||||
@ignore ; do not indent in this node
|
||||
@auto ; behaves like 'autoindent' buffer option
|
||||
@zero_indent ; sets this node at position 0 (no indent)
|
||||
@indent.begin ; indent children when matching this node
|
||||
@indent.end ; marks the end of indented block
|
||||
@indent.align ; behaves like python aligned/hanging indent
|
||||
@indent.dedent ; dedent children when matching this node
|
||||
@indent.branch ; dedent itself when matching this node
|
||||
@indent.ignore ; do not indent in this node
|
||||
@indent.auto ; behaves like 'autoindent' buffer option
|
||||
@indent.zero ; sets this node at position 0 (no indent)
|
||||
```
|
||||
|
||||
[Matrix channel]: https://matrix.to/#/#nvim-treesitter:matrix.org
|
||||
|
|
|
|||
|
|
@ -224,29 +224,29 @@ Supported options:
|
|||
}
|
||||
|
||||
`@indent` *nvim-treesitter-indentation-queries*
|
||||
Queries can use the following captures: `@indent` and `@dedent`,
|
||||
`@branch`, `@indent_end` or `@aligned_indent`. An `@ignore` capture tells
|
||||
treesitter to ignore indentation and a `@zero_indent` capture sets
|
||||
Queries can use the following captures: `@indent.begin` and `@indent.dedent`,
|
||||
`@indent.branch`, `@indent.end` or `@indent.align`. An `@indent.ignore` capture tells
|
||||
treesitter to ignore indentation and a `@indent.zero` capture sets
|
||||
the indentation to 0.
|
||||
|
||||
`@indent` *nvim-treesitter-indentation-indent*
|
||||
The `@indent` specifies that the next line should be indented. Multiple
|
||||
`@indent.begin` *nvim-treesitter-indentation-indent.begin*
|
||||
The `@indent.begin` specifies that the next line should be indented. Multiple
|
||||
indents on the same line get collapsed. Eg.
|
||||
|
||||
>
|
||||
(
|
||||
(if_statement)
|
||||
(ERROR "else") @indent
|
||||
(ERROR "else") @indent.begin
|
||||
)
|
||||
<
|
||||
Indent can also have `immediate_indent` set using a `#set!` directive, which
|
||||
Indent can also have `indent.immediate` set using a `#set!` directive, which
|
||||
permits the next line to indent even when the block intended to be indented
|
||||
has no content yet, improving interactive typing.
|
||||
|
||||
eg for python:
|
||||
>
|
||||
((if_statement) @indent
|
||||
(#set! "immediate_indent" 1))
|
||||
((if_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
<
|
||||
|
||||
Will allow:
|
||||
|
|
@ -254,19 +254,19 @@ Will allow:
|
|||
if True:<CR>
|
||||
# Auto indent to here
|
||||
|
||||
`@indent_end` *nvim-treesitter-indentation-indent_end*
|
||||
An `@indent_end` capture is used to specify that the indented region ends and
|
||||
`@indent.end` *nvim-treesitter-indentation-indent.end*
|
||||
An `@indent.end` capture is used to specify that the indented region ends and
|
||||
any text subsequent to the capture should be dedented.
|
||||
|
||||
`@branch` *nvim-treesitter-indentation-branch*
|
||||
An `@branch` capture is used to specify that a dedented region starts
|
||||
`@indent.branch` *nvim-treesitter-indentation-indent.branch*
|
||||
An `@indent.branch` capture is used to specify that a dedented region starts
|
||||
at the line including the captured nodes.
|
||||
|
||||
`@dedent` *nvim-treesitter-indentation-dedent*
|
||||
A `@dedent` capture specifies dedenting starting on the next line.
|
||||
`@indent.dedent` *nvim-treesitter-indentation-indent.dedent*
|
||||
A `@indent.dedent` capture specifies dedenting starting on the next line.
|
||||
>
|
||||
`@aligned_indent` *nvim-treesitter-indentation-aligned_indent*
|
||||
Aligned indent blocks may be specified with the `@aligned_indent` capture.
|
||||
`@indent.align` *nvim-treesitter-indentation-aligned_indent.align*
|
||||
Aligned indent blocks may be specified with the `@indent.align` capture.
|
||||
This permits
|
||||
|
||||
>
|
||||
|
|
@ -289,15 +289,15 @@ and finally
|
|||
c
|
||||
)
|
||||
<
|
||||
To specify the delimiters to use `open_delimiter` and `close_delimiter`
|
||||
should be used. Eg.
|
||||
To specify the delimiters to use `indent.open_delimiter` and
|
||||
`indent.close_delimiter` should be used. Eg.
|
||||
>
|
||||
((argument_list) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((argument_list) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
<
|
||||
|
||||
For some languages the last line of an `aligned_indent` block must not be
|
||||
For some languages the last line of an `indent.align` block must not be
|
||||
the same indent as the natural next line.
|
||||
|
||||
For example in python:
|
||||
|
|
@ -314,17 +314,17 @@ Is not correct, whereas
|
|||
pass
|
||||
|
||||
Would be correctly indented. This behavior may be chosen using
|
||||
`avoid_last_matching_next`. Eg.
|
||||
`indent.avoid_last_matching_next`. Eg.
|
||||
|
||||
>
|
||||
(if_statement
|
||||
condition: (parenthesized_expression) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")")
|
||||
(#set! "avoid_last_matching_next" 1)
|
||||
condition: (parenthesized_expression) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1)
|
||||
)
|
||||
<
|
||||
Could be used to specify that the last line of an `@aligned_indent` capture
|
||||
Could be used to specify that the last line of an `@indent.align` capture
|
||||
should be additionally indented to avoid clashing with the indent of the first
|
||||
line of the block inside an if.
|
||||
|
||||
|
|
|
|||
|
|
@ -52,18 +52,31 @@ end
|
|||
|
||||
local get_indents = tsutils.memoize_by_buf_tick(function(bufnr, root, lang)
|
||||
local map = {
|
||||
auto = {},
|
||||
indent = {},
|
||||
indent_end = {},
|
||||
dedent = {},
|
||||
branch = {},
|
||||
ignore = {},
|
||||
aligned_indent = {},
|
||||
zero_indent = {},
|
||||
indent = {
|
||||
auto = {},
|
||||
begin = {},
|
||||
["end"] = {},
|
||||
dedent = {},
|
||||
branch = {},
|
||||
ignore = {},
|
||||
align = {},
|
||||
zero = {},
|
||||
},
|
||||
}
|
||||
|
||||
local function split(to_split)
|
||||
local t = {}
|
||||
for str in string.gmatch(to_split, "([^.]+)") do
|
||||
table.insert(t, str)
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
for name, node, metadata in queries.iter_captures(bufnr, "indents", root, lang) do
|
||||
map[name][node:id()] = metadata or {}
|
||||
local path = split(name)
|
||||
-- node may contain a period so append directly.
|
||||
table.insert(path, node:id())
|
||||
queries.insert_to_path(map, path, metadata or {})
|
||||
end
|
||||
|
||||
return map
|
||||
|
|
@ -116,7 +129,7 @@ function M.get_indent(lnum)
|
|||
if is_empty_line then
|
||||
local prevlnum = vim.fn.prevnonblank(lnum)
|
||||
node = get_last_node_at_line(root, prevlnum)
|
||||
if q.indent_end[node:id()] then
|
||||
if q.indent["end"][node:id()] then
|
||||
node = get_first_node_at_line(root, lnum)
|
||||
end
|
||||
else
|
||||
|
|
@ -134,16 +147,16 @@ function M.get_indent(lnum)
|
|||
-- tracks to ensure multiple indent levels are not applied for same line
|
||||
local is_processed_by_row = {}
|
||||
|
||||
if q.zero_indent[node:id()] then
|
||||
if q.indent.zero[node:id()] then
|
||||
return 0
|
||||
end
|
||||
|
||||
while node do
|
||||
-- do 'autoindent' if not marked as @indent
|
||||
if
|
||||
not q.indent[node:id()]
|
||||
and not q.aligned_indent[node:id()]
|
||||
and q.auto[node:id()]
|
||||
not q.indent.begin[node:id()]
|
||||
and not q.indent.align[node:id()]
|
||||
and q.indent.auto[node:id()]
|
||||
and node:start() < lnum - 1
|
||||
and lnum - 1 <= node:end_()
|
||||
then
|
||||
|
|
@ -153,7 +166,12 @@ function M.get_indent(lnum)
|
|||
-- Do not indent if we are inside an @ignore block.
|
||||
-- If a node spans from L1,C1 to L2,C2, we know that lines where L1 < line <= L2 would
|
||||
-- have their indentations contained by the node.
|
||||
if not q.indent[node:id()] and q.ignore[node:id()] and node:start() < lnum - 1 and lnum - 1 <= node:end_() then
|
||||
if
|
||||
not q.indent.begin[node:id()]
|
||||
and q.indent.ignore[node:id()]
|
||||
and node:start() < lnum - 1
|
||||
and lnum - 1 <= node:end_()
|
||||
then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
|
@ -163,7 +181,7 @@ function M.get_indent(lnum)
|
|||
|
||||
if
|
||||
not is_processed_by_row[srow]
|
||||
and ((q.branch[node:id()] and srow == lnum - 1) or (q.dedent[node:id()] and srow ~= lnum - 1))
|
||||
and ((q.indent.branch[node:id()] and srow == lnum - 1) or (q.indent.dedent[node:id()] and srow ~= lnum - 1))
|
||||
then
|
||||
indent = indent - indent_size
|
||||
is_processed = true
|
||||
|
|
@ -179,16 +197,16 @@ function M.get_indent(lnum)
|
|||
if
|
||||
should_process
|
||||
and (
|
||||
q.indent[node:id()]
|
||||
and (srow ~= erow or is_in_err or q.indent[node:id()].immediate_indent)
|
||||
and (srow ~= lnum - 1 or q.indent[node:id()].start_at_same_line)
|
||||
q.indent.begin[node:id()]
|
||||
and (srow ~= erow or is_in_err or q.indent.begin[node:id()]["indent.immediate"])
|
||||
and (srow ~= lnum - 1 or q.indent.begin[node:id()]["indent.start_at_same_line"])
|
||||
)
|
||||
then
|
||||
indent = indent + indent_size
|
||||
is_processed = true
|
||||
end
|
||||
|
||||
if is_in_err and not q.aligned_indent[node:id()] then
|
||||
if is_in_err and not q.indent.align[node:id()] then
|
||||
-- only when the node is in error, promote the
|
||||
-- first child's aligned indent to the error node
|
||||
-- to work around ((ERROR "X" . (_)) @aligned_indent (#set! "delimeter" "AB"))
|
||||
|
|
@ -196,25 +214,25 @@ function M.get_indent(lnum)
|
|||
-- (ERROR "X" @aligned_indent (#set! "delimeter" "AB") . (_))
|
||||
-- and we will fish it out here.
|
||||
for c in node:iter_children() do
|
||||
if q.aligned_indent[c:id()] then
|
||||
q.aligned_indent[node:id()] = q.aligned_indent[c:id()]
|
||||
if q.indent.align[c:id()] then
|
||||
q.indent.align[node:id()] = q.indent.align[c:id()]
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
-- do not indent for nodes that starts-and-ends on same line and starts on target line (lnum)
|
||||
if should_process and q.aligned_indent[node:id()] and (srow ~= erow or is_in_err) and (srow ~= lnum - 1) then
|
||||
local metadata = q.aligned_indent[node:id()]
|
||||
if should_process and q.indent.align[node:id()] and (srow ~= erow or is_in_err) and (srow ~= lnum - 1) then
|
||||
local metadata = q.indent.align[node:id()]
|
||||
local o_delim_node, o_is_last_in_line ---@type TSNode|nil, boolean|nil
|
||||
local c_delim_node, c_is_last_in_line ---@type TSNode|nil, boolean|nil, boolean|nil
|
||||
local indent_is_absolute = false
|
||||
if metadata.open_delimiter then
|
||||
o_delim_node, o_is_last_in_line = find_delimiter(bufnr, node, metadata.open_delimiter)
|
||||
if metadata["indent.open_delimiter"] then
|
||||
o_delim_node, o_is_last_in_line = find_delimiter(bufnr, node, metadata["indent.open_delimiter"])
|
||||
else
|
||||
o_delim_node = node
|
||||
end
|
||||
if metadata.close_delimiter then
|
||||
c_delim_node, c_is_last_in_line = find_delimiter(bufnr, node, metadata.close_delimiter)
|
||||
if metadata["indent.close_delimiter"] then
|
||||
c_delim_node, c_is_last_in_line = find_delimiter(bufnr, node, metadata["indent.close_delimiter"])
|
||||
else
|
||||
c_delim_node = node
|
||||
end
|
||||
|
|
@ -245,7 +263,7 @@ function M.get_indent(lnum)
|
|||
-- Then its indent level shouldn't be affected by `@aligned_indent` node
|
||||
indent = math.max(indent - indent_size, 0)
|
||||
else
|
||||
indent = o_scol + (metadata.increment or 1)
|
||||
indent = o_scol + (metadata["indent.increment"] or 1)
|
||||
indent_is_absolute = true
|
||||
end
|
||||
end
|
||||
|
|
@ -254,9 +272,9 @@ function M.get_indent(lnum)
|
|||
if c_srow and c_srow ~= o_srow and c_srow == lnum - 1 then
|
||||
-- delims end on current line, and are not open and closed same line.
|
||||
-- then this last line may need additional indent to avoid clashes
|
||||
-- with the next. `avoid_last_matching_next` controls this behavior,
|
||||
-- with the next. `indent.avoid_last_matching_next` controls this behavior,
|
||||
-- for example this is needed for function parameters.
|
||||
avoid_last_matching_next = metadata.avoid_last_matching_next or false
|
||||
avoid_last_matching_next = metadata["indent.avoid_last_matching_next"] or false
|
||||
end
|
||||
if avoid_last_matching_next then
|
||||
-- last line must be indented more in cases where
|
||||
|
|
|
|||
|
|
@ -213,6 +213,24 @@ local function prepare_query(bufnr, query_name, root, root_lang)
|
|||
}
|
||||
end
|
||||
|
||||
-- Given a path (i.e. a List(String)) this functions inserts value at path
|
||||
---@param object any
|
||||
---@param path string[]
|
||||
---@param value any
|
||||
function M.insert_to_path(object, path, value)
|
||||
local curr_obj = object
|
||||
|
||||
for index = 1, (#path - 1) do
|
||||
if curr_obj[path[index]] == nil then
|
||||
curr_obj[path[index]] = {}
|
||||
end
|
||||
|
||||
curr_obj = curr_obj[path[index]]
|
||||
end
|
||||
|
||||
curr_obj[path[#path]] = value
|
||||
end
|
||||
|
||||
---@param query Query
|
||||
---@param bufnr integer
|
||||
---@param start_row integer
|
||||
|
|
@ -230,24 +248,6 @@ function M.iter_prepared_matches(query, qnode, bufnr, start_row, end_row)
|
|||
return t
|
||||
end
|
||||
|
||||
-- Given a path (i.e. a List(String)) this functions inserts value at path
|
||||
---@param object any
|
||||
---@param path string[]
|
||||
---@param value any
|
||||
local function insert_to_path(object, path, value)
|
||||
local curr_obj = object
|
||||
|
||||
for index = 1, (#path - 1) do
|
||||
if curr_obj[path[index]] == nil then
|
||||
curr_obj[path[index]] = {}
|
||||
end
|
||||
|
||||
curr_obj = curr_obj[path[index]]
|
||||
end
|
||||
|
||||
curr_obj[path[#path]] = value
|
||||
end
|
||||
|
||||
local matches = query:iter_matches(qnode, bufnr, start_row, end_row)
|
||||
|
||||
local function iterator()
|
||||
|
|
@ -260,9 +260,9 @@ function M.iter_prepared_matches(query, qnode, bufnr, start_row, end_row)
|
|||
local name = query.captures[id] -- name of the capture in the query
|
||||
if name ~= nil then
|
||||
local path = split(name .. ".node")
|
||||
insert_to_path(prepared_match, path, node)
|
||||
M.insert_to_path(prepared_match, path, node)
|
||||
local metadata_path = split(name .. ".metadata")
|
||||
insert_to_path(prepared_match, metadata_path, metadata[id])
|
||||
M.insert_to_path(prepared_match, metadata_path, metadata[id])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -273,10 +273,10 @@ function M.iter_prepared_matches(query, qnode, bufnr, start_row, end_row)
|
|||
for _, pred in pairs(preds) do
|
||||
-- functions
|
||||
if pred[1] == "set!" and type(pred[2]) == "string" then
|
||||
insert_to_path(prepared_match, split(pred[2]), pred[3])
|
||||
M.insert_to_path(prepared_match, split(pred[2]), pred[3])
|
||||
end
|
||||
if pred[1] == "make-range!" and type(pred[2]) == "string" and #pred == 4 then
|
||||
insert_to_path(
|
||||
M.insert_to_path(
|
||||
prepared_match,
|
||||
split(pred[2] .. ".node"),
|
||||
tsrange.TSRange.from_nodes(bufnr, match[pred[3]], match[pred[4]])
|
||||
|
|
|
|||
|
|
@ -2,21 +2,21 @@
|
|||
(list)
|
||||
(scope)
|
||||
(cons)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
[
|
||||
(entry)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
[
|
||||
(array)
|
||||
(object)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
"}" @indent_end
|
||||
"}" @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
(diagnostic_comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -7,66 +7,66 @@
|
|||
(initializer_list)
|
||||
(init_declarator)
|
||||
(expression_statement)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(
|
||||
ERROR
|
||||
"for" "(" @indent ";" ";" ")" @indent_end)
|
||||
"for" "(" @indent.begin ";" ";" ")" @indent.end)
|
||||
(
|
||||
(for_statement
|
||||
body: (_) @_body
|
||||
) @indent
|
||||
) @indent.begin
|
||||
(#not-has-type? @_body compound_statement)
|
||||
)
|
||||
|
||||
(
|
||||
while_statement
|
||||
condition: (_) @indent
|
||||
condition: (_) @indent.begin
|
||||
)
|
||||
(
|
||||
(while_statement
|
||||
body: (_) @_body
|
||||
) @indent
|
||||
) @indent.begin
|
||||
(#not-has-type? @_body compound_statement)
|
||||
)
|
||||
|
||||
(
|
||||
(if_statement)
|
||||
(ERROR "else") @indent
|
||||
(ERROR "else") @indent.begin
|
||||
)
|
||||
|
||||
(
|
||||
if_statement
|
||||
condition: (_) @indent
|
||||
condition: (_) @indent.begin
|
||||
)
|
||||
;; Make sure all cases of if-else are tagged with @indent
|
||||
;; Make sure all cases of if-else are tagged with @indent.begin
|
||||
;; So we will offset the indents for the else case
|
||||
(
|
||||
(if_statement
|
||||
consequence: (compound_statement)
|
||||
"else" @branch
|
||||
"else" @indent.branch
|
||||
alternative:
|
||||
[
|
||||
[ "{" "}" ] @branch
|
||||
(compound_statement ["{" "}"] @branch)
|
||||
[ "{" "}" ] @indent.branch
|
||||
(compound_statement ["{" "}"] @indent.branch)
|
||||
(_)
|
||||
]
|
||||
) @indent
|
||||
) @indent.begin
|
||||
)
|
||||
(
|
||||
(if_statement
|
||||
consequence: (_ ";" @indent_end) @_consequence
|
||||
) @indent
|
||||
consequence: (_ ";" @indent.end) @_consequence
|
||||
) @indent.begin
|
||||
(#not-has-type? @_consequence compound_statement)
|
||||
)
|
||||
(
|
||||
(if_statement
|
||||
consequence: (_) @_consequence
|
||||
"else" @branch
|
||||
"else" @indent.branch
|
||||
alternative:
|
||||
[
|
||||
[ "{" "}" ] @branch
|
||||
(compound_statement ["{" "}"] @branch)
|
||||
[ "{" "}" ] @indent.branch
|
||||
(compound_statement ["{" "}"] @indent.branch)
|
||||
(_)
|
||||
]
|
||||
)
|
||||
|
|
@ -83,19 +83,19 @@
|
|||
consequence: (_)
|
||||
alternative:
|
||||
[
|
||||
(if_statement consequence: (compound_statement) @dedent)
|
||||
(if_statement consequence: (compound_statement) @indent.dedent)
|
||||
(_)
|
||||
] @dedent
|
||||
] @indent.dedent
|
||||
)
|
||||
)
|
||||
|
||||
(compound_statement "}" @indent_end)
|
||||
(compound_statement "}" @indent.end)
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
(statement_identifier)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
"#define"
|
||||
|
|
@ -105,18 +105,19 @@
|
|||
"#if"
|
||||
"#else"
|
||||
"#endif"
|
||||
] @zero_indent
|
||||
] @indent.zero
|
||||
|
||||
[
|
||||
(preproc_arg)
|
||||
(string_literal)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
||||
((ERROR (parameter_declaration)) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
([(argument_list) (parameter_list)] @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((ERROR (parameter_declaration)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
([(argument_list) (parameter_list)] @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
(comment) @indent.auto
|
||||
|
||||
(comment) @auto
|
||||
|
|
|
|||
|
|
@ -11,26 +11,26 @@
|
|||
(struct)
|
||||
(struct_shorthand)
|
||||
(union)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
((struct_shorthand (property)) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((struct_shorthand (property)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
((const_list (const_value)) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((const_list (const_value)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
[
|
||||
"}"
|
||||
")"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
(intent_def)
|
||||
(slot_def)
|
||||
(alias_def)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(ERROR "]") @indent
|
||||
(ERROR "]") @indent.begin
|
||||
|
|
|
|||
|
|
@ -3,21 +3,21 @@
|
|||
(map)
|
||||
(imap)
|
||||
(array)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"]"
|
||||
"}"
|
||||
">"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[ "<" ">" ] @branch
|
||||
[ "<" ">" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@
|
|||
[
|
||||
(class_specifier)
|
||||
(condition_clause)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
((field_initializer_list) @indent.begin
|
||||
(#set! indent.start_at_same_line 1))
|
||||
(access_specifier) @indent.branch
|
||||
|
||||
((field_initializer_list) @indent
|
||||
(#set! "start_at_same_line" 1))
|
||||
(access_specifier) @branch
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
[
|
||||
(block)
|
||||
(declaration)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(block ("}") @branch)
|
||||
("}") @dedent
|
||||
(block ("}") @indent.branch)
|
||||
("}") @indent.dedent
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
[
|
||||
(import_spec_list)
|
||||
(field)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"}"
|
||||
"]"
|
||||
")"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@
|
|||
(block_statement)
|
||||
(case_statement)
|
||||
(token_string)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"(" ")"
|
||||
"{" "}"
|
||||
"[" "]"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
(nesting_block_comment)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
(list_literal)
|
||||
(return_statement)
|
||||
(arguments)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"("
|
||||
|
|
@ -19,13 +19,13 @@
|
|||
"}"
|
||||
"["
|
||||
"]"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
"}"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
; this one is for dedenting the else block
|
||||
(if_statement (block) @branch)
|
||||
(if_statement (block) @indent.branch)
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
(node)
|
||||
(property)
|
||||
(integer_cells)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"}"
|
||||
">"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(comment)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
|
|
|||
|
|
@ -16,42 +16,42 @@
|
|||
(switch_statement)
|
||||
(template_substitution)
|
||||
(ternary_expression)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(arguments (call_expression) @indent)
|
||||
(binary_expression (call_expression) @indent)
|
||||
(expression_statement (call_expression) @indent)
|
||||
(arguments (call_expression) @indent.begin)
|
||||
(binary_expression (call_expression) @indent.begin)
|
||||
(expression_statement (call_expression) @indent.begin)
|
||||
(arrow_function
|
||||
body: (_) @_body
|
||||
(#not-has-type? @_body statement_block)
|
||||
) @indent
|
||||
) @indent.begin
|
||||
(assignment_expression
|
||||
right: (_) @_right
|
||||
(#not-has-type? @_right arrow_function function)
|
||||
) @indent
|
||||
) @indent.begin
|
||||
(variable_declarator
|
||||
value: (_) @_value
|
||||
(#not-has-type? @_value arrow_function call_expression function)
|
||||
) @indent
|
||||
) @indent.begin
|
||||
|
||||
(arguments ")" @indent_end)
|
||||
(object "}" @indent_end)
|
||||
(statement_block "}" @indent_end)
|
||||
(arguments ")" @indent.end)
|
||||
(object "}" @indent.end)
|
||||
(statement_block "}" @indent.end)
|
||||
|
||||
[
|
||||
(arguments (object))
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @branch
|
||||
(statement_block "{" @branch)
|
||||
] @indent.branch
|
||||
(statement_block "{" @indent.branch)
|
||||
|
||||
(parenthesized_expression ("(" (_) ")" @indent_end))
|
||||
["}" "]"] @indent_end
|
||||
(parenthesized_expression ("(" (_) ")" @indent.end))
|
||||
["}" "]"] @indent.end
|
||||
|
||||
[
|
||||
(comment)
|
||||
(template_string)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
||||
(ERROR) @auto
|
||||
(ERROR) @indent.auto
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
(stab_clause)
|
||||
(tuple)
|
||||
(arguments)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
")"
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
"rescue"
|
||||
"}"
|
||||
"end"
|
||||
] @indent_end @branch
|
||||
] @indent.end @indent.branch
|
||||
|
||||
; Elixir pipelines are not indented, but other binary operator chains are
|
||||
((binary_operator operator: _ @_operator) @indent (#not-eq? @_operator "|>"))
|
||||
((binary_operator operator: _ @_operator) @indent.begin (#not-eq? @_operator "|>"))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
(reduction) @indent
|
||||
(reduction) @indent.begin
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
(if_statement)
|
||||
(begin_statement)
|
||||
(switch_statement)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
(else_if_clause)
|
||||
(else_clause)
|
||||
"end"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
[
|
||||
"{"
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[(dict) (key_value)] @indent
|
||||
[(dict) (key_value)] @indent.begin
|
||||
|
||||
|
||||
[
|
||||
(comment)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
(where_statement)
|
||||
(derived_type_definition)
|
||||
(enum)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
(end_module_statement)
|
||||
|
|
@ -24,4 +24,4 @@
|
|||
(end_type_statement)
|
||||
(end_enum_statement)
|
||||
(end_where_statement)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -5,15 +5,15 @@
|
|||
(afx_element_self_closing)
|
||||
(eel_array)
|
||||
(eel_object)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
|
||||
(block end: _ @branch)
|
||||
(value_dsl end: _ @branch)
|
||||
(eel_array end: _ @branch)
|
||||
(eel_object end: _ @branch)
|
||||
(block end: _ @indent.branch)
|
||||
(value_dsl end: _ @indent.branch)
|
||||
(eel_array end: _ @indent.branch)
|
||||
(eel_object end: _ @indent.branch)
|
||||
[
|
||||
(afx_closing_element)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@
|
|||
(match_body)
|
||||
(set_body)
|
||||
(get_body)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
(elif_clause)
|
||||
(else_clause)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(string)
|
||||
|
|
@ -26,46 +26,46 @@
|
|||
(dictionary)
|
||||
(parenthesized_expression)
|
||||
(ERROR)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
||||
[
|
||||
(pass_statement)
|
||||
(continue_statement)
|
||||
(break_statement)
|
||||
(return_statement)
|
||||
] @dedent
|
||||
] @indent.dedent
|
||||
|
||||
[
|
||||
(ERROR "[")
|
||||
(ERROR "(")
|
||||
(ERROR "{")
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
;; This only works with expanded tabs.
|
||||
; ((parameters) @aligned_indent (#set! "open_delimiter" "(") (#set! "close_delimiter" ")"))
|
||||
; ((arguments) @aligned_indent (#set! "open_delimiter" "(") (#set! "close_delimiter" ")"))
|
||||
; ((parameters) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")"))
|
||||
; ((arguments) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")"))
|
||||
|
||||
;; The following queries either do not agree with the current body parsing or are
|
||||
;; attempted workarounds. Specifically as the last statement of a body. Opening
|
||||
;; a new line in between statements works well.
|
||||
;;
|
||||
;; The overall experience is poor, so I've opted for @auto.
|
||||
;; The overall experience is poor, so I've opted for @indent.auto.
|
||||
;;
|
||||
;; The gdscript parser will need to be patched to accommodate more interactive
|
||||
;; edits. As far as I can tell the parser greedily consumes whitespace
|
||||
;; as a zero-width token which causes trouble when inserting indents.
|
||||
|
||||
;; This indents correctly with tabs.
|
||||
; (arguments) @indent
|
||||
; (parameters) @indent
|
||||
; (array) @indent
|
||||
; (dictionary) @indent
|
||||
; (parenthesized_expression) @indent
|
||||
; (arguments) @indent.begin
|
||||
; (parameters) @indent.begin
|
||||
; (array) @indent.begin
|
||||
; (dictionary) @indent.begin
|
||||
; (parenthesized_expression) @indent.begin
|
||||
|
||||
;; Partial workaround for when the cursor is on the bracket character and a newline
|
||||
;; is created with <o>. Without this the newline is opened with extra
|
||||
;; indentation.
|
||||
; (body (_ (array "]" @indent_end) ) _)
|
||||
; (body (_ (array "]" @indent.end) ) _)
|
||||
;; Problematic behaviors occur at the last statement of a body.
|
||||
;; with @dedent:
|
||||
;; - [ | ] i<CR> will dedent ] to 0.
|
||||
|
|
@ -75,4 +75,4 @@
|
|||
;; - [ | ] i<CR> same
|
||||
;; - [
|
||||
;; ]| o will open new line with extra indent.
|
||||
;(body (_ (array "]" @auto) ) .)
|
||||
;(body (_ (array "]" @indent.auto) ) .)
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
(todo)
|
||||
(try)
|
||||
(tuple)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
")"
|
||||
"]"
|
||||
"}"
|
||||
] @indent_end @branch
|
||||
] @indent.end @indent.branch
|
||||
|
||||
; Gleam pipelines are not indented, but other binary expression chains are
|
||||
((binary_expression operator: _ @_operator) @indent (#not-eq? @_operator "|>"))
|
||||
((binary_expression operator: _ @_operator) @indent.begin (#not-eq? @_operator "|>"))
|
||||
|
|
|
|||
|
|
@ -13,21 +13,21 @@
|
|||
(call_expression)
|
||||
(parameter_list)
|
||||
(struct_type)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(const_declaration ")" @branch)
|
||||
(import_spec_list ")" @branch)
|
||||
(var_declaration ")" @branch)
|
||||
(const_declaration ")" @indent.branch)
|
||||
(import_spec_list ")" @indent.branch)
|
||||
(var_declaration ")" @indent.branch)
|
||||
|
||||
[
|
||||
"}"
|
||||
")"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
(parameter_list ")" @branch)
|
||||
(parameter_list ")" @indent.branch)
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
[
|
||||
(definition)
|
||||
(selection)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -12,25 +12,25 @@
|
|||
(array_literal)
|
||||
(struct_literal)
|
||||
(tuple_literal)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(if_statement
|
||||
("(" condition: (_) ")") @indent)
|
||||
("(" condition: (_) ")") @indent.begin)
|
||||
|
||||
[
|
||||
"}"
|
||||
"]"
|
||||
")"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
(concatenated_string)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
(object)
|
||||
(tuple)
|
||||
(function_call)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"]"
|
||||
")"
|
||||
"}"
|
||||
] @branch @indent_end
|
||||
] @indent.branch @indent.end
|
||||
|
||||
(comment) @auto
|
||||
(ERROR) @auto
|
||||
(comment) @indent.auto
|
||||
(ERROR) @indent.auto
|
||||
|
|
|
|||
|
|
@ -3,18 +3,18 @@
|
|||
(component)
|
||||
(slot)
|
||||
(tag)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
; Dedent at the end of each tag, component, and slot
|
||||
[
|
||||
(end_component)
|
||||
(end_slot)
|
||||
(end_tag)
|
||||
] @branch @dedent
|
||||
] @indent.branch @indent.dedent
|
||||
|
||||
; Self-closing tags and components should not change
|
||||
; indentation level of sibling nodes
|
||||
[
|
||||
(self_closing_component)
|
||||
(self_closing_tag)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
; inherits: json
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
(#not-any-of? @_not_special "meta" "link")
|
||||
)
|
||||
(element (self_closing_tag))
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
; These tags are usually written one-lined and doesn't use self-closing tags so special-cased them
|
||||
; but add indent to the tag to make sure attributes inside them are still indented if written multi-lined
|
||||
|
|
@ -15,20 +15,20 @@
|
|||
(start_tag
|
||||
(tag_name) @_special)
|
||||
(#any-of? @_special "meta" "link")
|
||||
) @indent
|
||||
) @indent.begin
|
||||
|
||||
|
||||
; These are the nodes that will be captured when we do `normal o`
|
||||
; But last element has already been ended, so capturing this
|
||||
; to mark end of last element
|
||||
(element (end_tag [">"] @indent_end))
|
||||
(element (self_closing_tag "/>" @indent_end))
|
||||
(element (end_tag [">"] @indent.end))
|
||||
(element (self_closing_tag "/>" @indent.end))
|
||||
|
||||
; Script/style elements aren't indented, so only branch the end tag of other elements
|
||||
(element (end_tag) @branch)
|
||||
(element (end_tag) @indent.branch)
|
||||
[
|
||||
">"
|
||||
"/>"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
(paired_statement) @indent
|
||||
(end_paired_statement) @indent_end
|
||||
(branch_statement) @branch
|
||||
(paired_statement) @indent.begin
|
||||
(end_paired_statement) @indent.end
|
||||
(branch_statement) @indent.branch
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
(array_initializer)
|
||||
(argument_list)
|
||||
(formal_parameters)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(expression_statement (method_invocation) @indent)
|
||||
(expression_statement (method_invocation) @indent.begin)
|
||||
|
||||
[
|
||||
"("
|
||||
|
|
@ -19,13 +19,14 @@
|
|||
"}"
|
||||
"["
|
||||
"]"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
"}" @indent_end
|
||||
"}" @indent.end
|
||||
|
||||
(line_comment) @ignore
|
||||
(line_comment) @indent.ignore
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(block_comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
[
|
||||
(object)
|
||||
(array)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"}"
|
||||
"]"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
; inherits: json
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -3,19 +3,19 @@
|
|||
(jsx_element)
|
||||
(jsx_self_closing_element)
|
||||
(jsx_expression)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(jsx_fragment
|
||||
("<" ">" (_) "<" @branch "/" ">" @indent_end)
|
||||
("<" ">" (_) "<" @indent.branch "/" ">" @indent.end)
|
||||
)
|
||||
|
||||
(jsx_closing_element (">" @indent_end))
|
||||
(jsx_self_closing_element ">" @indent_end)
|
||||
(jsx_closing_element (">" @indent.end))
|
||||
(jsx_self_closing_element ">" @indent.end)
|
||||
|
||||
[
|
||||
(jsx_closing_element)
|
||||
">"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
; <button
|
||||
; />
|
||||
(jsx_self_closing_element "/" @branch)
|
||||
(jsx_self_closing_element "/" @indent.branch)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
(comprehension_expression)
|
||||
(matrix_expression)
|
||||
(vector_expression)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"end"
|
||||
|
|
@ -34,10 +34,10 @@
|
|||
(elseif_clause)
|
||||
(catch_clause)
|
||||
(finally_clause)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
(node (node_children) @indent)
|
||||
(node (node_children) @indent.begin)
|
||||
|
||||
"}" @indent_end
|
||||
"}" @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
[
|
||||
(journal_item)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
|
|
|||
|
|
@ -13,17 +13,17 @@
|
|||
(table_constructor)
|
||||
(arguments)
|
||||
(return_statement)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"end"
|
||||
")"
|
||||
"}"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
(return_statement
|
||||
(expression_list
|
||||
(function_call))) @dedent
|
||||
(function_call))) @indent.dedent
|
||||
|
||||
[
|
||||
"end"
|
||||
|
|
@ -35,8 +35,9 @@
|
|||
(elseif_statement)
|
||||
"else"
|
||||
(else_statement)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(comment) @auto
|
||||
(comment) @indent.auto
|
||||
|
||||
(string) @indent.auto
|
||||
|
||||
(string) @auto
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
(pool)
|
||||
(rule)
|
||||
(build)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@
|
|||
(recInitializer)
|
||||
(arrInitializer)
|
||||
(defaultValue)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(defProc (block) @indent)
|
||||
(defProc (block) @indent.begin)
|
||||
|
||||
[
|
||||
(kEnd)
|
||||
|
|
@ -29,4 +29,4 @@
|
|||
(declSection)
|
||||
"]"
|
||||
")"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -11,18 +11,18 @@
|
|||
(match_block)
|
||||
(case_statement)
|
||||
"["
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
||||
(compound_statement "}" @indent_end)
|
||||
(compound_statement "}" @indent.end)
|
||||
|
||||
(ERROR) @auto
|
||||
(ERROR) @indent.auto
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
(block) @indent
|
||||
(block) @indent.begin
|
||||
|
||||
(ERROR) @auto
|
||||
(ERROR) @indent.auto
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -14,97 +14,91 @@
|
|||
(lambda)
|
||||
|
||||
(concatenated_string)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
((list) @aligned_indent
|
||||
(#set! "open_delimiter" "[")
|
||||
(#set! "close_delimiter" "]")
|
||||
(#set! "dedent_lone_close_delimiter" 1)
|
||||
((list) @indent.align
|
||||
(#set! indent.open_delimiter "[")
|
||||
(#set! indent.close_delimiter "]")
|
||||
)
|
||||
((dictionary) @aligned_indent
|
||||
(#set! "open_delimiter" "{")
|
||||
(#set! "close_delimiter" "}")
|
||||
(#set! "dedent_lone_close_delimiter" 1)
|
||||
((dictionary) @indent.align
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}")
|
||||
)
|
||||
((set) @aligned_indent
|
||||
(#set! "open_delimiter" "{")
|
||||
(#set! "close_delimiter" "}")
|
||||
(#set! "dedent_lone_close_delimiter" 1)
|
||||
((set) @indent.align
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}")
|
||||
)
|
||||
|
||||
((for_statement) @indent
|
||||
(#set! "immediate_indent" 1))
|
||||
((if_statement) @indent
|
||||
(#set! "immediate_indent" 1))
|
||||
((while_statement) @indent
|
||||
(#set! "immediate_indent" 1))
|
||||
((try_statement) @indent
|
||||
(#set! "immediate_indent" 1))
|
||||
(ERROR "try" ":" @indent (#set! "immediate_indent" 1))
|
||||
((function_definition) @indent
|
||||
(#set! "immediate_indent" 1))
|
||||
((class_definition) @indent
|
||||
(#set! "immediate_indent" 1))
|
||||
((with_statement) @indent
|
||||
(#set! "immediate_indent" 1))
|
||||
((for_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
((if_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
((while_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
((try_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
(ERROR "try" ":" @indent.begin (#set! indent.immediate 1))
|
||||
((function_definition) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
((class_definition) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
((with_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
(if_statement
|
||||
condition: (parenthesized_expression) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")")
|
||||
(#set! "avoid_last_matching_next" 1)
|
||||
condition: (parenthesized_expression) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1)
|
||||
)
|
||||
(while_statement
|
||||
condition: (parenthesized_expression) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")")
|
||||
(#set! "avoid_last_matching_next" 1)
|
||||
condition: (parenthesized_expression) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1)
|
||||
)
|
||||
|
||||
(ERROR "(" @aligned_indent (#set! "open_delimiter" "(") (#set! "close_delimiter" ")") . (_))
|
||||
((argument_list) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((parameters) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")")
|
||||
(#set! "avoid_last_matching_next" 1))
|
||||
((tuple) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
(ERROR "(" @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") . (_))
|
||||
((argument_list) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
((parameters) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1))
|
||||
((tuple) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
(ERROR "[" @aligned_indent (#set! "open_delimiter" "[") (#set! "close_delimiter" "]") . (_))
|
||||
(list "]" @indent_end)
|
||||
(ERROR "[" @indent.align (#set! indent.open_delimiter "[") (#set! indent.close_delimiter "]") . (_))
|
||||
|
||||
(ERROR "{" @aligned_indent (#set! "open_delimiter" "{") (#set! "close_delimiter" "}") . (_))
|
||||
(dictionary "}" @indent_end)
|
||||
(set "}" @indent_end)
|
||||
(ERROR "{" @indent.align (#set! indent.open_delimiter "{") (#set! indent.close_delimiter "}") . (_))
|
||||
|
||||
(parenthesized_expression ")" @indent_end)
|
||||
(generator_expression ")" @indent_end)
|
||||
(list_comprehension "]" @indent_end)
|
||||
(set_comprehension "}" @indent_end)
|
||||
(dictionary_comprehension "}" @indent_end)
|
||||
(parenthesized_expression ")" @indent.end)
|
||||
(generator_expression ")" @indent.end)
|
||||
(list_comprehension "]" @indent.end)
|
||||
(set_comprehension "}" @indent.end)
|
||||
(dictionary_comprehension "}" @indent.end)
|
||||
|
||||
(tuple_pattern ")" @indent_end)
|
||||
(list_pattern "]" @indent_end)
|
||||
(tuple_pattern ")" @indent.end)
|
||||
(list_pattern "]" @indent.end)
|
||||
|
||||
|
||||
(return_statement
|
||||
[
|
||||
(_) @indent_end
|
||||
(_) @indent.end
|
||||
(_
|
||||
[
|
||||
(_)
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @indent_end .)
|
||||
] @indent.end .)
|
||||
(attribute
|
||||
attribute: (_) @indent_end)
|
||||
attribute: (_) @indent.end)
|
||||
(call
|
||||
arguments: (_ ")" @indent_end))
|
||||
"return" @indent_end
|
||||
arguments: (_ ")" @indent.end))
|
||||
"return" @indent.end
|
||||
] .)
|
||||
|
||||
[
|
||||
|
|
@ -115,7 +109,7 @@
|
|||
(else_clause)
|
||||
(except_clause)
|
||||
(finally_clause)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(string) @auto
|
||||
(string) @indent.auto
|
||||
|
||||
|
|
|
|||
|
|
@ -4,20 +4,20 @@
|
|||
(classMember)
|
||||
(classlessPredicate)
|
||||
(quantified)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(block_comment)
|
||||
(line_comment)
|
||||
(qldoc)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
[
|
||||
(list)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @branch
|
||||
] @indent.begin
|
||||
|
|
|
|||
|
|
@ -10,24 +10,24 @@
|
|||
"while"
|
||||
"repeat"
|
||||
"for"
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
((binary operator: (special)) @indent)
|
||||
((binary operator: (special)) @indent.begin)
|
||||
|
||||
[
|
||||
"}"
|
||||
")"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
((formal_parameters (identifier)) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((formal_parameters (identifier)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[
|
||||
(comment)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
(rule_set) @indent
|
||||
(rule_set) @indent.begin
|
||||
|
||||
(block "}" @branch)
|
||||
(block "}" @indent.branch)
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
(map)
|
||||
(tuple)
|
||||
(struct)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@
|
|||
(unless)
|
||||
(assignment)
|
||||
(parenthesized_statements)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"end"
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[
|
||||
"end"
|
||||
|
|
@ -38,6 +38,6 @@
|
|||
(else)
|
||||
(rescue)
|
||||
(ensure)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -22,38 +22,39 @@
|
|||
(parameters)
|
||||
(token_tree)
|
||||
(macro_definition)
|
||||
] @indent
|
||||
(trait_item body: (_) @indent)
|
||||
(string_literal (escape_sequence)) @indent
|
||||
] @indent.begin
|
||||
(trait_item body: (_) @indent.begin)
|
||||
(string_literal (escape_sequence)) @indent.begin
|
||||
|
||||
(block "}" @indent_end)
|
||||
(block "}" @indent.end)
|
||||
(enum_item
|
||||
body: (enum_variant_list "}" @indent_end))
|
||||
body: (enum_variant_list "}" @indent.end))
|
||||
(impl_item
|
||||
body: (declaration_list "}" @indent_end))
|
||||
body: (declaration_list "}" @indent.end))
|
||||
(match_expression
|
||||
body: (match_block "}" @indent_end))
|
||||
body: (match_block "}" @indent.end))
|
||||
(mod_item
|
||||
body: (declaration_list "}" @indent_end))
|
||||
body: (declaration_list "}" @indent.end))
|
||||
(struct_item
|
||||
body: (field_declaration_list "}" @indent_end))
|
||||
body: (field_declaration_list "}" @indent.end))
|
||||
(trait_item
|
||||
body: (declaration_list "}" @indent_end))
|
||||
body: (declaration_list "}" @indent.end))
|
||||
|
||||
(impl_item (where_clause) @dedent)
|
||||
(impl_item (where_clause) @indent.dedent)
|
||||
|
||||
[
|
||||
"where"
|
||||
")"
|
||||
"]"
|
||||
"}"
|
||||
] @branch
|
||||
(impl_item (declaration_list) @branch)
|
||||
] @indent.branch
|
||||
(impl_item (declaration_list) @indent.branch)
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(string_literal)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
||||
|
||||
(raw_string_literal) @auto
|
||||
(raw_string_literal) @indent.auto
|
||||
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@
|
|||
(mixin_statement)
|
||||
(while_statement)
|
||||
(each_statement)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
(handler_body)
|
||||
(consequence_body)
|
||||
(global_single)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
"}" @indent_end
|
||||
"}" @indent.end
|
||||
|
||||
(comment) @auto
|
||||
(comment) @indent.auto
|
||||
|
||||
(string_literal) @auto
|
||||
(string_literal) @indent.auto
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
(sparse_switch_directive)
|
||||
(subannotation_directive)
|
||||
(list)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
".end annotation"
|
||||
|
|
@ -22,11 +22,11 @@
|
|||
".end sparse-switch"
|
||||
".end subannotation"
|
||||
"}"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
(data_block)
|
||||
(blank_node_property_list)
|
||||
(collection)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
[
|
||||
"}"
|
||||
"]"
|
||||
")"
|
||||
(triples_same_subject)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -15,39 +15,39 @@
|
|||
(foreach_statement)
|
||||
; (try_statement)
|
||||
(catch_statement)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(
|
||||
(if_statement)
|
||||
(ERROR "else") @indent
|
||||
(ERROR "else") @indent.begin
|
||||
)
|
||||
|
||||
(if_statement
|
||||
condition: (_) @indent)
|
||||
condition: (_) @indent.begin)
|
||||
|
||||
(if_statement
|
||||
consequence: (_)
|
||||
(else_statement) @indent)
|
||||
(else_statement) @indent.begin)
|
||||
|
||||
(do_while_statement
|
||||
"do"
|
||||
(_) @indent)
|
||||
(_) @indent.begin)
|
||||
|
||||
(try_statement
|
||||
(_) @indent
|
||||
(catch_statement) @indent)
|
||||
(_) @indent.begin
|
||||
(catch_statement) @indent.begin)
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[
|
||||
"}"
|
||||
")"
|
||||
"]"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
|
|
@ -55,4 +55,4 @@
|
|||
|
||||
(string)
|
||||
(verbatim_string)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -19,28 +19,28 @@
|
|||
|
||||
(lambda)
|
||||
(function_definition)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(if_statement
|
||||
condition: (parenthesized_expression) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")")
|
||||
condition: (parenthesized_expression) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
)
|
||||
((ERROR "(" . (_)) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((argument_list) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((argument_list) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((parameters) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((tuple) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((ERROR "(" . (_)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
((argument_list) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
((argument_list) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
((parameters) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
((tuple) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
[
|
||||
")"
|
||||
|
|
@ -48,6 +48,6 @@
|
|||
"}"
|
||||
(elif_clause)
|
||||
(else_clause)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(string) @auto
|
||||
(string) @indent.auto
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
(variable_definition_sequence (variable_definition))
|
||||
(control_structure)
|
||||
(return_statement)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
(parameter_call_list (argument_calls))
|
||||
|
|
@ -23,9 +23,9 @@
|
|||
"}"
|
||||
"["
|
||||
"]"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(block_comment)
|
||||
(line_comment)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
(component)
|
||||
(tag)
|
||||
(block)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
; Dedent at the end of each tag, as well as a subblock
|
||||
[
|
||||
|
|
@ -11,4 +11,4 @@
|
|||
(end_component)
|
||||
(end_block)
|
||||
(subblock)
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
(await_statement)
|
||||
(script_element)
|
||||
(style_element)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
(end_tag)
|
||||
|
|
@ -15,6 +15,6 @@
|
|||
(await_end_expr)
|
||||
">"
|
||||
"/>"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -9,19 +9,19 @@
|
|||
(if)
|
||||
(let)
|
||||
(value_suffix)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"}"
|
||||
"]"
|
||||
")"
|
||||
">"
|
||||
] @indent_end
|
||||
] @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[ "<" ">" ] @branch
|
||||
[ "<" ">" ] @indent.branch
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
(if_statement)
|
||||
(return_statement)
|
||||
(while_statement)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"{"
|
||||
|
|
@ -15,4 +15,4 @@
|
|||
")"
|
||||
"end"
|
||||
"then"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
(definition) @indent
|
||||
(definition) @indent.begin
|
||||
|
||||
((parameters (parameter)) @aligned_indent
|
||||
(#set! "open_delimiter" "(")
|
||||
(#set! "close_delimiter" ")"))
|
||||
((parameters (parameter)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
"}" @indent_end
|
||||
"}" @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -1,69 +1,69 @@
|
|||
; Control flow {{{
|
||||
(if_expression) @indent
|
||||
"then" @branch
|
||||
"else" @branch
|
||||
(if_expression) @indent.begin
|
||||
"then" @indent.branch
|
||||
"else" @indent.branch
|
||||
|
||||
(while_expression) @indent
|
||||
"do" @branch
|
||||
(while_expression) @indent.begin
|
||||
"do" @indent.branch
|
||||
|
||||
(for_expression) @indent
|
||||
"to" @branch
|
||||
(for_expression) @indent.begin
|
||||
"to" @indent.branch
|
||||
; }}}
|
||||
|
||||
; Class {{{
|
||||
(class_declaration) @indent
|
||||
(class_declaration "}" @indent_end)
|
||||
(class_declaration) @indent.begin
|
||||
(class_declaration "}" @indent.end)
|
||||
|
||||
(class_type) @indent
|
||||
(class_type "}" @indent_end)
|
||||
(class_type) @indent.begin
|
||||
(class_type "}" @indent.end)
|
||||
; }}}
|
||||
|
||||
; Groups {{{
|
||||
(let_expression) @indent
|
||||
"in" @branch
|
||||
"end" @branch
|
||||
(let_expression "end" @indent_end)
|
||||
(let_expression) @indent.begin
|
||||
"in" @indent.branch
|
||||
"end" @indent.branch
|
||||
(let_expression "end" @indent.end)
|
||||
|
||||
(sequence_expression) @indent
|
||||
")" @branch
|
||||
(sequence_expression ")" @indent_end)
|
||||
(sequence_expression) @indent.begin
|
||||
")" @indent.branch
|
||||
(sequence_expression ")" @indent.end)
|
||||
; }}}
|
||||
|
||||
; Functions and methods {{{
|
||||
(parameters) @indent
|
||||
(parameters ")" @indent_end)
|
||||
(parameters) @indent.begin
|
||||
(parameters ")" @indent.end)
|
||||
|
||||
(function_call) @indent
|
||||
(method_call) @indent
|
||||
")" @branch
|
||||
(function_call) @indent.begin
|
||||
(method_call) @indent.begin
|
||||
")" @indent.branch
|
||||
|
||||
(function_declaration) @indent
|
||||
(primitive_declaration) @indent
|
||||
(method_declaration) @indent
|
||||
(function_declaration) @indent.begin
|
||||
(primitive_declaration) @indent.begin
|
||||
(method_declaration) @indent.begin
|
||||
; }}}
|
||||
|
||||
; Values and expressions {{{
|
||||
(array_value) @indent
|
||||
"]" @branch
|
||||
(array_value "]" @indent_end)
|
||||
(array_value) @indent.begin
|
||||
"]" @indent.branch
|
||||
(array_value "]" @indent.end)
|
||||
|
||||
(array_expression) @indent
|
||||
"of" @branch
|
||||
(array_expression) @indent.begin
|
||||
"of" @indent.branch
|
||||
|
||||
(record_expression) @indent
|
||||
"}" @branch
|
||||
(record_expression "}" @indent_end)
|
||||
(record_expression) @indent.begin
|
||||
"}" @indent.branch
|
||||
(record_expression "}" @indent.end)
|
||||
|
||||
(record_type) @indent
|
||||
"}" @branch
|
||||
(record_type "}" @indent_end)
|
||||
(record_type) @indent.begin
|
||||
"}" @indent.branch
|
||||
(record_type "}" @indent.end)
|
||||
|
||||
(variable_declaration) @indent
|
||||
(variable_declaration) @indent.begin
|
||||
; }}}
|
||||
|
||||
; Misc{{{
|
||||
(comment) @ignore
|
||||
(string_literal) @ignore
|
||||
(comment) @indent.ignore
|
||||
(string_literal) @indent.ignore
|
||||
; }}}
|
||||
|
||||
; vim: sw=2 foldmethod=marker
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
[
|
||||
(array)
|
||||
(inline_table)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
(statement)
|
||||
(blank_node_property_list)
|
||||
(collection)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
[
|
||||
"]"
|
||||
")"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@
|
|||
(enum_declaration)
|
||||
(interface_declaration)
|
||||
(object_type)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
(node) @indent
|
||||
(node) @indent.begin
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
(memory_execution) @auto
|
||||
(memory_execution) @indent.auto
|
||||
|
||||
[
|
||||
(subroutine)
|
||||
(brackets)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
"}" @indent_end
|
||||
"}" @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
(map)
|
||||
(call_expression)
|
||||
(parameter_list)]
|
||||
@indent
|
||||
@indent.begin
|
||||
|
||||
[ "}"]
|
||||
@branch
|
||||
@indent.branch
|
||||
|
||||
(parameter_list ")" @branch)
|
||||
(parameter_list ")" @indent.branch)
|
||||
|
||||
(comment) @ignore
|
||||
(comment) @indent.ignore
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
[
|
||||
(template_element)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(template_element (end_tag ">" @indent_end) @branch)
|
||||
(template_element (end_tag ">" @indent.end) @indent.branch)
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@
|
|||
(compound_statement)
|
||||
(loop_statement)
|
||||
(struct_declaration)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(compound_statement "}" @indent_end)
|
||||
(loop_statement "}" @indent_end)
|
||||
(function_declaration ")" @indent_end)
|
||||
(struct_declaration "}" @indent_end)
|
||||
(compound_statement "}" @indent.end)
|
||||
(loop_statement "}" @indent.end)
|
||||
(function_declaration ")" @indent.end)
|
||||
(struct_declaration "}" @indent.end)
|
||||
|
||||
[
|
||||
"else"
|
||||
")"
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[(line_comment) (block_comment)] @auto
|
||||
[(line_comment) (block_comment)] @indent.auto
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@
|
|||
"#ifndef"
|
||||
"#else"
|
||||
"#endif"
|
||||
] @zero_indent
|
||||
] @indent.zero
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[
|
||||
(block_mapping_pair value: (block_node))
|
||||
(block_sequence_item)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(ERROR) @auto
|
||||
(ERROR) @indent.auto
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
(module) @indent
|
||||
(submodule) @indent
|
||||
(statement) @indent
|
||||
(extension_statement) @indent
|
||||
(statement ";" @indent_end)
|
||||
(extension_statement ";" @indent_end)
|
||||
(block "}" @indent_end @branch)
|
||||
(module) @indent.begin
|
||||
(submodule) @indent.begin
|
||||
(statement) @indent.begin
|
||||
(extension_statement) @indent.begin
|
||||
(statement ";" @indent.end)
|
||||
(extension_statement ";" @indent.end)
|
||||
(block "}" @indent.end @indent.branch)
|
||||
|
||||
((string) @aligned_indent
|
||||
(#set! "open_delimiter" "\"")
|
||||
(#set! "close_delimiter" "\""))
|
||||
((string) @indent.align
|
||||
(#set! indent.open_delimiter "\"")
|
||||
(#set! indent.close_delimiter "\""))
|
||||
|
|
|
|||
|
|
@ -5,22 +5,22 @@
|
|||
(json_array)
|
||||
(json_object)
|
||||
(parenthesized_expression)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
; TODO: can't get this to work, goal is to indent at the property ":" prefix
|
||||
; ((list (identifier) (property)) @aligned_indent
|
||||
; (#set! "open_delimiter" "(")
|
||||
; (#set! "close_delimiter" ")"))
|
||||
; ((list (identifier) (property)) @indent.align
|
||||
; (#set! indent.open_delimiter "(")
|
||||
; (#set! indent.close_delimiter ")"))
|
||||
|
||||
[")" "}" "]"] @indent_end
|
||||
[")" "}" "]"] @indent.end
|
||||
|
||||
[ "{" "}" ] @branch
|
||||
[ "{" "}" ] @indent.branch
|
||||
|
||||
[ "(" ")" ] @branch
|
||||
[ "(" ")" ] @indent.branch
|
||||
|
||||
[ "[" "]" ] @branch
|
||||
[ "[" "]" ] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @auto
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
(ContainerDecl)
|
||||
(SwitchExpr)
|
||||
(InitList)
|
||||
] @indent
|
||||
] @indent.begin
|
||||
|
||||
(Block "}" @indent_end)
|
||||
(Block "}" @indent.end)
|
||||
|
||||
[
|
||||
"("
|
||||
|
|
@ -14,11 +14,11 @@
|
|||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @branch
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(container_doc_comment)
|
||||
(doc_comment)
|
||||
(LINESTRING)
|
||||
] @ignore
|
||||
] @indent.ignore
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue