From e398c24ba19948727affdc6a29254ac69a6b7699 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 03:35:02 -0300 Subject: syntax: helix's indents.scm vendored beside each grammar's textobjects.scm and embedded the same way (zig's adapted to this grammar's node names, rust's \A regexes written with ^, erlang's left out as it does not compile here), compiled when first asked for as a Lazy beside the textobjects, so a new line can take its indent from the tree Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- vendor/queries/go/indents.scm | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 vendor/queries/go/indents.scm (limited to 'vendor/queries/go') diff --git a/vendor/queries/go/indents.scm b/vendor/queries/go/indents.scm new file mode 100644 index 00000000..3734f458 --- /dev/null +++ b/vendor/queries/go/indents.scm @@ -0,0 +1,55 @@ +; Vendored from helix (https://github.com/helix-editor/helix) at 278b24389: +; runtime/queries/go/indents.scm. +; Licensed under the Mozilla Public License 2.0 (vendor/queries/helix.LICENSE, +; https://mozilla.org/MPL/2.0/). + +[ + (import_declaration) + (const_declaration) + (type_declaration) + (type_spec) + (func_literal) + (literal_value) + (literal_element) + (keyed_element) + (expression_case) + (default_case) + (type_case) + (communication_case) + (argument_list) + (parameter_list) + (field_declaration_list) + (block) + (var_declaration) + (selector_expression) + (binary_expression) +] @indent + +[ + "]" + ")" +] @outdent + +; Switches and selects aren't indented, only their case bodies are. +; Outdent all closing braces except those closing switches or selects. +( + (_ "}" @outdent) @outer + (#not-kind-eq? @outer "select_statement") + (#not-kind-eq? @outer "type_switch_statement") + (#not-kind-eq? @outer "expression_switch_statement") +) + +; Handle ERROR nodes for when auto-pairs is disabled. +; Typing an opening delimiter without a closing one produces an ERROR node. +(ERROR "{") @indent @extend +(ERROR "(") @indent +(ERROR "[") @indent + +; Labels (`Loop:`, `done:`) are de-indented one level by gofmt. +; Capturing the label_name (a child, not an ancestor of the labeled body) +; outdents only the label line. +(labeled_statement + (label_name) @outdent) + +; Raw string literals (backticks) span lines and are literal content. +(raw_string_literal) @opaque -- cgit v1.3