Initial public release of Warp.

Repo-Sync-Origin: warpdotdev/warp-internal@12af1d983b
This commit is contained in:
David Stern
2026-04-28 08:43:33 -05:00
commit 0dbd3d567a
4982 changed files with 1431549 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
# Language Grammars
Example of how to add a new language grammar: https://github.com/warpdotdev/warp-internal/pull/11501/files
## TSLanguage
We need a [TSLanguage(https://tree-sitter.github.io/tree-sitter/using-parsers#the-basic-objects) object to parse a source code file. We use open-source libraries that provide functions that create these objects. These functions are usually written in C but we can use them in Rust crates.
## config.yaml
You can find this information on language specific documentation and style guides.
Another place to look is at Zed's config.toml files, e.g.: https://github.com/zed-industries/zed/blob/85bdd9329b550475aae34340e50abd4e79f2dd82/crates/languages/src/python/config.toml
**Note:** We don't use custom highlights.scm files - we use arborium's bundled highlighting queries instead.
## indents.scm
This controls how we know when a cursor should be indented relative to the previous line.
Other code editors need this information so we can base ours on other open-source code editors. We primarily need to support indent and outdent captures. More full-featured code editors will support more advanced features.
Some example sources to check include:
1. https://github.com/helix-editor/helix/blob/101a74bf6edbbfdf9b0628a0bdbbc307ebe10ff2/runtime/queries/python/indents.scm
1. https://github.com/zed-industries/zed/blob/85bdd9329b550475aae34340e50abd4e79f2dd82/crates/languages/src/python/indents.scm
+11
View File
@@ -0,0 +1,11 @@
display_name: "C"
indent_unit:
space: 4
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,12 @@
(comment) @comment
; Function declarations
(function_declarator declarator: (identifier) @definition)
; Class declarations
(struct_specifier name: (type_identifier) @definition.class body:(_))
(declaration type: (union_specifier name: (type_identifier) @definition.class))
; Type declarations
(type_definition declarator: (type_identifier) @definition.type)
(enum_specifier name: (type_identifier) @definition.type)
+34
View File
@@ -0,0 +1,34 @@
[
(compound_statement)
(declaration_list)
(field_declaration_list)
(enumerator_list)
(parameter_list)
(init_declarator)
(expression_statement)
] @indent
[
"case"
"}"
"]"
")"
] @outdent
(if_statement
consequence: (_) @indent
(#not-kind-eq? @indent "compound_statement")
(#set! "scope" "all"))
(while_statement
body: (_) @indent
(#not-kind-eq? @indent "compound_statement")
(#set! "scope" "all"))
(do_statement
body: (_) @indent
(#not-kind-eq? @indent "compound_statement")
(#set! "scope" "all"))
(for_statement
")"
(_) @indent
(#not-kind-eq? @indent "compound_statement")
(#set! "scope" "all"))
+11
View File
@@ -0,0 +1,11 @@
display_name: "C++"
indent_unit:
space: 4
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,16 @@
(comment) @comment
; Function declarations and definitions
(function_declarator declarator: (identifier) @definition)
(function_declarator declarator: (qualified_identifier name: (identifier) @definition))
(function_declarator declarator: (field_identifier) @definition)
(template_method name: (field_identifier) @definition)
; Class declarations
(struct_specifier name: (type_identifier) @definition.class body:(_))
(declaration type: (union_specifier name: (type_identifier) @definition.class))
(class_specifier name: (type_identifier) @definition.class)
; Type declarations
(type_definition declarator: (type_identifier) @definition.type)
(enum_specifier name: (type_identifier) @definition.type)
+35
View File
@@ -0,0 +1,35 @@
[
(compound_statement)
(declaration_list)
(field_declaration_list)
(enumerator_list)
(parameter_list)
(init_declarator)
(expression_statement)
] @indent
[
"case"
"}"
"]"
")"
(access_specifier)
] @outdent
(if_statement
consequence: (_) @indent
(#not-kind-eq? @indent "compound_statement")
(#set! "scope" "all"))
(while_statement
body: (_) @indent
(#not-kind-eq? @indent "compound_statement")
(#set! "scope" "all"))
(do_statement
body: (_) @indent
(#not-kind-eq? @indent "compound_statement")
(#set! "scope" "all"))
(for_statement
")"
(_) @indent
(#not-kind-eq? @indent "compound_statement")
(#set! "scope" "all"))
@@ -0,0 +1,11 @@
display_name: "C#"
indent_unit:
space: 4
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,9 @@
(comment) @comment
; Methods
(method_declaration name: (identifier) @definition)
(local_function_statement name: (identifier) @definition)
; Class declarations
(class_declaration name: (identifier) @definition.class)
(interface_declaration name: (identifier) @definition.interface)
@@ -0,0 +1,8 @@
[
(assignment_expression)
(if_statement)
(for_statement)
] @indent
(_ "{" "}" @end) @indent
(_ "(" ")" @end) @indent
@@ -0,0 +1,4 @@
display_name: "CSS"
indent_unit:
space: 4
brackets: []
@@ -0,0 +1,3 @@
(comment) @comment
(function_name) @definition.function
@@ -0,0 +1,7 @@
[
(block)
] @indent
[
"}"
] @outdent
@@ -0,0 +1,11 @@
display_name: "Dockerfile"
indent_unit:
space: 4
comment_prefix: "#"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,11 @@
display_name: "Elixir"
indent_unit:
space: 2
comment_prefix: "#"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,54 @@
; Definitions
; * modules and protocols
(call
target: (identifier) @ignore
(arguments (alias) @name)
(#any-of? @ignore "defmodule" "defprotocol")) @definition.module
; * functions/macros
(call
target: (identifier) @ignore
(arguments
[
; zero-arity functions with no parentheses
(identifier) @name
; regular function clause
(call target: (identifier) @name)
; function clause with a guard clause
(binary_operator
left: (call target: (identifier) @name)
operator: "when")
])
(#any-of? @ignore "def" "defp" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp")) @definition.function
; References
; ignore calls to kernel/special-forms keywords
(call
target: (identifier) @ignore
(#any-of? @ignore "def" "defp" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp" "defmodule" "defprotocol" "defimpl" "defstruct" "defexception" "defoverridable" "alias" "case" "cond" "else" "for" "if" "import" "quote" "raise" "receive" "require" "reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with"))
; ignore module attributes
(unary_operator
operator: "@"
operand: (call
target: (identifier) @ignore))
; * function call
(call
target: [
; local
(identifier) @name
; remote
(dot
right: (identifier) @name)
]) @reference.call
; * pipe into function call
(binary_operator
operator: "|>"
right: (identifier) @name) @reference.call
; * modules
(alias) @name @reference.module
@@ -0,0 +1,13 @@
[
(after_block)
(anonymous_function)
(catch_block)
(do_block)
(else_block)
(rescue_block)
(stab_clause)
] @indent
[
"end"
] @outdent
@@ -0,0 +1,10 @@
display_name: "Go"
indent_unit: tab
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,8 @@
(comment) @comment
; Function definitions
(function_declaration name: (identifier) @definition.func)
(method_declaration name: (field_identifier) @function.func)
; Type declarations
(type_spec name: (type_identifier) @definition.type)
@@ -0,0 +1,25 @@
[
(import_declaration)
(const_declaration)
(parameter_list)
(type_declaration)
(type_spec)
(func_literal)
(literal_value)
(literal_element)
(keyed_element)
(expression_case)
(default_case)
(type_case)
(communication_case)
(argument_list)
(field_declaration_list)
(block)
(var_declaration)
] @indent
[
"]"
")"
"}"
] @outdent
+11
View File
@@ -0,0 +1,11 @@
display_name: "HCL"
indent_unit:
space: 2
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
+16
View File
@@ -0,0 +1,16 @@
[
(block)
(object)
(tuple)
(function_call)
] @indent.begin
[
"]"
")"
"}"
] @indent.branch @indent.end
(comment) @indent.auto
(ERROR) @indent.auto
@@ -0,0 +1,4 @@
display_name: "HTML"
indent_unit:
space: 4
brackets: []
@@ -0,0 +1,11 @@
display_name: "Java"
indent_unit:
space: 4
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,7 @@
(line_comment) @comment
; Methods
(method_declaration name: (identifier) @definition)
; Class declarations
(class_declaration name: (identifier) @definition.class)
@@ -0,0 +1,21 @@
[
(class_body)
(enum_body)
(interface_body)
(constructor_body)
(annotation_type_body)
(module_body)
(block)
(switch_block)
(array_initializer)
(argument_list)
(formal_parameters)
(annotation_argument_list)
(element_value_array_initializer)
] @indent
[
"}"
")"
"]"
] @outdent
@@ -0,0 +1,11 @@
display_name: "JavaScript"
indent_unit:
space: 4
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,10 @@
(comment) @comment
; Function and method definitions
(function_expression name: (identifier) @definition.function)
(function_declaration name: (identifier) @definition.function)
(method_definition name: (property_identifier) @definition)
; Class declarations
(class name: (_) @definition.class)
(class_declaration name: (_) @definition.class)
@@ -0,0 +1,44 @@
[
(array)
(object)
(arguments)
(formal_parameters)
(statement_block)
(switch_statement)
(switch_case)
(switch_default)
(object_pattern)
(class_body)
(named_imports)
(binary_expression)
(return_statement)
(template_substitution)
(export_clause)
(call_expression)
(assignment_expression)
(member_expression)
(lexical_declaration)
(variable_declaration)
(assignment_expression)
(if_statement)
(for_statement)
(for_in_statement)
(while_statement)
(do_statement)
(try_statement)
(with_statement)
(throw_statement)
(export_statement)
(import_statement)
] @indent
[
"}"
"]"
")"
] @outdent
@@ -0,0 +1,10 @@
display_name: "JSON"
indent_unit:
space: 4
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,9 @@
[
(object)
(array)
] @indent
[
"]"
"}"
] @outdent
+14
View File
@@ -0,0 +1,14 @@
display_name: "JSX"
indent_unit:
space: 2
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
- start: "<"
end: ">"
@@ -0,0 +1,18 @@
(comment) @comment
; Function and method definitions
(function_expression name: (identifier) @definition.function)
(function_declaration name: (identifier) @definition.function)
(method_definition name: (property_identifier) @definition)
; Class declarations
(class name: (_) @definition.class)
(class_declaration name: (_) @definition.class)
; JSX component definitions
(jsx_element
open_tag: (jsx_opening_element
name: (identifier) @definition.component))
(jsx_self_closing_element
name: (identifier) @definition.component)
+45
View File
@@ -0,0 +1,45 @@
[
(array)
(object)
(arguments)
(formal_parameters)
(statement_block)
(switch_statement)
(switch_case)
(switch_default)
(object_pattern)
(class_body)
(named_imports)
(binary_expression)
(return_statement)
(template_substitution)
(export_clause)
(call_expression)
(assignment_expression)
(member_expression)
(lexical_declaration)
(variable_declaration)
(assignment_expression)
(if_statement)
(for_statement)
(for_in_statement)
(while_statement)
(do_statement)
(try_statement)
(with_statement)
(throw_statement)
(export_statement)
(import_statement)
] @indent
[
"}"
"]"
")"
] @outdent
@@ -0,0 +1,13 @@
display_name: "Kotlin"
indent_unit:
space: 4
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
- start: "<"
end: ">"
+11
View File
@@ -0,0 +1,11 @@
display_name: "Lua"
indent_unit:
space: 2
comment_prefix: "--"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
+47
View File
@@ -0,0 +1,47 @@
[
(function_definition)
(function_declaration)
(field)
(do_statement)
(method_index_expression)
(while_statement)
(repeat_statement)
(if_statement)
"then"
(for_statement)
(return_statement)
(table_constructor)
(arguments)
] @indent.begin
[
"end"
"}"
"]]"
] @indent.end
(")" @indent.end
(#not-has-parent? @indent.end parameters))
(return_statement
(expression_list
(function_call))) @indent.dedent
[
"end"
"then"
"until"
"}"
")"
"elseif"
(elseif_statement)
"else"
(else_statement)
] @indent.branch
(comment) @indent.auto
(string) @indent.auto
(ERROR
"function") @indent.begin
@@ -0,0 +1,11 @@
display_name: "Objective-C"
indent_unit:
space: 4
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,21 @@
(comment) @comment
; Function declarations
(function_declarator declarator: (identifier) @definition)
; Class declarations
(struct_specifier name: (type_identifier) @definition.class body:(_))
(declaration type: (union_specifier name: (type_identifier) @definition.class))
; Type declarations
(type_definition declarator: (type_identifier) @definition.type)
(enum_specifier name: (type_identifier) @definition.type)
; ObjC Classes/Interfaces
; (class_interface name: (type_identifier) @definition.class)
; (category_interface name: (type_identifier) @definition.class)
; (protocol_declaration name: (protocol_name) @definition.interface)
; ObjC Methods
; (method_declaration) @definition.method
; (method_definition) @definition.method
@@ -0,0 +1,35 @@
[
(compound_statement)
(declaration_list)
(field_declaration_list)
(enumerator_list)
(parameter_list)
(init_declarator)
(expression_statement)
] @indent
[
"case"
"}"
"]"
")"
; "@end"
] @outdent
(if_statement
consequence: (_) @indent
(#not-kind-eq? @indent "compound_statement")
(#set! "scope" "all"))
(while_statement
body: (_) @indent
(#not-kind-eq? @indent "compound_statement")
(#set! "scope" "all"))
(do_statement
body: (_) @indent
(#not-kind-eq? @indent "compound_statement")
(#set! "scope" "all"))
(for_statement
")"
(_) @indent
(#not-kind-eq? @indent "compound_statement")
(#set! "scope" "all"))
+13
View File
@@ -0,0 +1,13 @@
display_name: "PHP"
indent_unit:
space: 2
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
- start: "<"
end: ">"
+68
View File
@@ -0,0 +1,68 @@
[
(array_creation_expression)
(parenthesized_expression)
(compound_statement)
(declaration_list)
(member_call_expression)
(binary_expression)
(return_statement)
(arguments)
(formal_parameters)
(enum_declaration_list)
(switch_block)
(match_block)
(case_statement)
(default_statement)
(property_hook_list)
] @indent.begin
(return_statement
[
(object_creation_expression)
(anonymous_function)
(arrow_function)
(match_expression)
]) @indent.dedent
[
")"
"}"
"]"
] @indent.branch
(comment) @indent.auto
(arguments
")" @indent.end)
(formal_parameters
")" @indent.end)
(compound_statement
"}" @indent.end)
(declaration_list
"}" @indent.end)
(enum_declaration_list
"}" @indent.end)
(return_statement
";" @indent.end)
(property_hook_list
"}" @indent.end)
(ERROR
"(" @indent.align
.
(_)
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")"))
(ERROR
"[" @indent.align
.
(_)
(#set! indent.open_delimiter "[")
(#set! indent.close_delimiter "]"))
@@ -0,0 +1,11 @@
display_name: "PowerShell"
indent_unit:
space: 4
comment_prefix: "#"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,12 @@
# source: https://peps.python.org/pep-0008/#indentation
display_name: "Python"
indent_unit:
space: 4
comment_prefix: "#"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,7 @@
(comment) @comment
; Function definitions
(function_definition name: (identifier) @definition.def)
; Class declarations
(class_definition name: (identifier) @definition.class)
@@ -0,0 +1,36 @@
[
(list)
(tuple)
(dictionary)
(set)
(if_statement)
(for_statement)
(while_statement)
(with_statement)
(try_statement)
(match_statement)
(case_clause)
(import_from_statement)
(parenthesized_expression)
(generator_expression)
(list_comprehension)
(set_comprehension)
(dictionary_comprehension)
(tuple_pattern)
(list_pattern)
(argument_list)
(parameters)
(binary_operator)
(function_definition)
(class_definition)
] @indent
[
")"
"]"
"}"
] @outdent
@@ -0,0 +1,11 @@
display_name: "Ruby"
indent_unit:
space: 4
comment_prefix: "#"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,43 @@
[
(class)
(singleton_class)
(method)
(singleton_method)
(module)
(call)
(if)
(block)
(do_block)
(hash)
(array)
(argument_list)
(case)
(while)
(until)
(for)
(begin)
(unless)
(assignment)
(parenthesized_statements)
] @indent.begin
[
"end"
")"
"}"
"]"
] @indent.end
[
"end"
")"
"}"
"]"
(when)
(elsif)
(else)
(rescue)
(ensure)
] @indent.branch
(comment) @indent.ignore
+93
View File
@@ -0,0 +1,93 @@
; The MIT License (MIT)
;
; Copyright (c) 2016 Rob Rix
;
; Permission is hereby granted, free of charge, to any person obtaining a copy
; of this software and associated documentation files (the "Software"), to deal
; in the Software without restriction, including without limitation the rights
; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
; copies of the Software, and to permit persons to whom the Software is
; furnished to do so, subject to the following conditions:
;
; The above copyright notice and this permission notice shall be included in all
; copies or substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
; SOFTWARE.
; DECLARATIONS AND SCOPES
(method) @local.scope
(class) @local.scope
[
(block)
(do_block)
] @local.scope
(identifier) @local.reference
(constant) @local.reference
(instance_variable) @local.reference
(module
name: (constant) @local.definition.namespace)
(class
name: (constant) @local.definition.type)
(method
name: [
(identifier)
(constant)
] @local.definition.function)
(singleton_method
name: [
(identifier)
(constant)
] @local.definition.function)
(method_parameters
(identifier) @local.definition.var)
(lambda_parameters
(identifier) @local.definition.var)
(block_parameters
(identifier) @local.definition.var)
(splat_parameter
(identifier) @local.definition.var)
(hash_splat_parameter
(identifier) @local.definition.var)
(optional_parameter
name: (identifier) @local.definition.var)
(destructured_parameter
(identifier) @local.definition.var)
(block_parameter
name: (identifier) @local.definition.var)
(keyword_parameter
name: (identifier) @local.definition.var)
(assignment
left: (_) @local.definition.var)
(left_assignment_list
(identifier) @local.definition.var)
(rest_assignment
(identifier) @local.definition.var)
(destructured_left_assignment
(identifier) @local.definition.var)
@@ -0,0 +1,11 @@
display_name: "Rust"
indent_unit:
space: 4
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,19 @@
(line_comment) @comment
(line_outer_doc_comment) @comment
(block_outer_doc_comment) @comment
; Function definitions
(function_item (identifier) @definition.fn)
(function_signature_item (identifier) @definition.fn)
; Struct declarations
(struct_item name: (type_identifier) @definition.struct)
; Enum declarations
(enum_item name: (type_identifier) @definition.enum)
; Trait declarations
(trait_item name: (type_identifier) @definition.trait)
; Type alias declarations
(type_item name: (type_identifier) @definition.type)
@@ -0,0 +1,33 @@
[
(use_list)
(block)
(match_block)
(arguments)
(parameters)
(declaration_list)
(field_declaration_list)
(field_initializer_list)
(struct_pattern)
(tuple_pattern)
(unit_expression)
(enum_variant_list)
(call_expression)
(binary_expression)
(field_expression)
(await_expression)
(tuple_expression)
(array_expression)
(where_clause)
(type_cast_expression)
(token_tree)
(macro_definition)
(token_tree_pattern)
(token_repetition)
] @indent
[
"}"
"]"
")"
] @outdent
@@ -0,0 +1,17 @@
display_name: "Scala"
indent_unit:
space: 2
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
- start: "\""
end: "\""
- start: "'"
end: "'"
- start: "`"
end: "`"
@@ -0,0 +1,32 @@
(comment) @comment
(block_comment) @comment
; Class declarations
(class_definition name: (identifier) @definition.class)
; Object declarations
(object_definition name: (identifier) @definition.class)
; Trait declarations
(trait_definition name: (identifier) @definition.class)
; Enum declarations
(enum_definition name: (identifier) @definition.class)
; Function/method declarations
(function_declaration name: (identifier) @definition)
(function_definition name: (identifier) @definition)
; Variable definitions
(val_definition pattern: (identifier) @definition)
(var_definition pattern: (identifier) @definition)
(val_declaration name: (identifier) @definition)
(var_declaration name: (identifier) @definition)
; Parameters
(parameter name: (identifier) @definition)
(binding name: (identifier) @definition)
(class_parameter name: (identifier) @definition)
; Type definitions
(type_definition name: (type_identifier) @definition.type)
@@ -0,0 +1,30 @@
; These indent queries adhere to nvim-tree-sytter syntax.
; See `nvim-tree-sitter-indentation-mod` vim help page.
[
(template_body)
(block)
(parameters)
(arguments)
(match_expression)
(splice_expression)
(import_declaration)
(function_definition)
(ERROR ":")
(ERROR "=")
("match")
(":")
("=")
] @indent.begin
(arguments ")" @indent.end)
"}" @indent.end
"end" @indent.end
[
")"
"]"
"}"
] @indent.branch
@@ -0,0 +1,11 @@
display_name: "Shell"
indent_unit:
space: 4
comment_prefix: "#"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,3 @@
(comment) @comment
(function_definition name: (word) @definition.function)
@@ -0,0 +1,12 @@
[
(function_definition)
(if_statement)
(for_statement)
(while_statement)
(case_statement)
(pipeline)
] @indent
[
"}"
] @outdent
+11
View File
@@ -0,0 +1,11 @@
display_name: "SQL"
indent_unit:
space: 2
comment_prefix: "--"
brackets:
- start: "("
end: ")"
- start: "["
end: "]"
- start: "{"
end: "}"
+27
View File
@@ -0,0 +1,27 @@
[
(select)
(cte)
(column_definitions)
(case)
(subquery)
(insert)
] @indent.begin
(block
(keyword_begin)
) @indent.begin
(column_definitions ")" @indent.branch)
(subquery ")" @indent.branch)
(cte ")" @indent.branch)
[
(keyword_end)
(keyword_values)
(keyword_into)
] @indent.branch
(keyword_end) @indent.end
@@ -0,0 +1,13 @@
# Starlark configuration for Warp
# Starlark is used by Bazel and has Python-like syntax
display_name: "Bazel (Starlark)"
indent_unit:
space: 4
comment_prefix: "#"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,9 @@
; Starlark symbol identification
(comment) @comment
; Function definitions
(function_definition name: (identifier) @definition.def)
; Variables assigned at module level (like rules, constants)
(assignment
left: (identifier) @definition.var)
@@ -0,0 +1,24 @@
; Starlark indentation rules
[
(list)
(dictionary)
(if_statement)
(for_statement)
(parenthesized_expression)
(list_comprehension)
(dictionary_comprehension)
(argument_list)
(parameters)
(binary_operator)
(function_definition)
] @indent
[
")"
"]"
"}"
] @outdent
@@ -0,0 +1,11 @@
display_name: "Swift"
indent_unit:
space: 4
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
+122
View File
@@ -0,0 +1,122 @@
; format-ignore
[
; ... refers to the section that will get affected by this indent.begin capture
(protocol_body) ; protocol Foo { ... }
(class_body) ; class Foo { ... }
(enum_class_body) ; enum Foo { ... }
(function_declaration) ; func Foo (...) {...}
(init_declaration) ; init(...) {...}
(deinit_declaration) ; deinit {...}
(computed_property) ; { ... }
(subscript_declaration) ; subscript Foo(...) { ... }
(computed_getter) ; get { ... }
(computed_setter) ; set { ... }
(assignment) ; a = b
(control_transfer_statement) ; return ...
(for_statement)
(while_statement)
(repeat_while_statement)
(do_statement)
(if_statement)
(switch_statement)
(guard_statement)
(type_parameters) ; x<Foo>
(tuple_type) ; (...)
(array_type) ; [String]
(dictionary_type) ; [Foo: Bar]
(call_expression) ; callFunc(...)
(tuple_expression) ; ( foo + bar )
(array_literal) ; [ foo, bar ]
(dictionary_literal) ; [ foo: bar, x: y ]
(lambda_literal)
(willset_didset_block)
(willset_clause)
(didset_clause)
] @indent.begin
(init_declaration) @indent.begin
(init_declaration
[
"init"
"("
] @indent.branch)
; indentation for init parameters
(init_declaration
")" @indent.branch @indent.end)
(init_declaration
(parameter) @indent.begin
(#set! indent.immediate))
; @something(...)
(modifiers
(attribute) @indent.begin)
(function_declaration
(modifiers
.
(attribute)
(_)* @indent.branch)
.
_ @indent.branch
(#not-kind-eq? @indent.branch "type_parameters" "parameter"))
(ERROR
[
"<"
"{"
"("
"["
]) @indent.begin
; if-elseif
(if_statement
(if_statement) @indent.dedent)
; case Foo:
; default Foo:
; @attribute default Foo:
(switch_entry
.
_ @indent.branch)
(function_declaration
")" @indent.branch)
(type_parameters
">" @indent.branch @indent.end .)
(tuple_expression
")" @indent.branch @indent.end)
(value_arguments
")" @indent.branch @indent.end)
(tuple_type
")" @indent.branch @indent.end)
(modifiers
(attribute
")" @indent.branch @indent.end))
[
"}"
"]"
] @indent.branch @indent.end
[
; (ERROR)
(comment)
(multiline_comment)
(raw_str_part)
(multi_line_string_literal)
] @indent.auto
(directive) @indent.ignore
@@ -0,0 +1,4 @@
display_name: "TOML"
indent_unit:
space: 2
comment_prefix: "#"
@@ -0,0 +1,11 @@
[
(array)
(inline_table)
] @indent.begin
[
"["
"]"
"{"
"}"
] @indent.branch
+14
View File
@@ -0,0 +1,14 @@
display_name: "TSX"
indent_unit:
space: 2
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
- start: "<"
end: ">"
@@ -0,0 +1,23 @@
(comment) @comment
; Function and method definitions
(function_expression name: (identifier) @definition.function)
(function_declaration name: (identifier) @definition.function)
(method_definition name: (property_identifier) @definition)
; Class declarations
(class name: (_) @definition.class)
(class_declaration name: (_) @definition.class)
; TypeScript specific definitions
(interface_declaration name: (type_identifier) @definition.interface)
(type_alias_declaration name: (type_identifier) @definition.type)
(enum_declaration name: (identifier) @definition.enum)
; JSX component definitions
(jsx_element
open_tag: (jsx_opening_element
name: (identifier) @definition.component))
(jsx_self_closing_element
name: (identifier) @definition.component)
+49
View File
@@ -0,0 +1,49 @@
[
(array)
(object)
(arguments)
(formal_parameters)
(statement_block)
(switch_statement)
(switch_case)
(switch_default)
(object_pattern)
(class_body)
(named_imports)
(binary_expression)
(return_statement)
(template_substitution)
(export_clause)
(enum_declaration)
(interface_declaration)
(object_type)
(call_expression)
(assignment_expression)
(member_expression)
(lexical_declaration)
(variable_declaration)
(assignment_expression)
(if_statement)
(for_statement)
(for_in_statement)
(while_statement)
(do_statement)
(try_statement)
(with_statement)
(throw_statement)
(export_statement)
(import_statement)
] @indent
[
"}"
"]"
")"
] @outdent
@@ -0,0 +1,11 @@
display_name: "TypeScript"
indent_unit:
space: 4
comment_prefix: "//"
brackets:
- start: "{"
end: "}"
- start: "("
end: ")"
- start: "["
end: "]"
@@ -0,0 +1,10 @@
(comment) @comment
; Function and method definitions
(function_expression name: (identifier) @definition.function)
(function_declaration name: (identifier) @definition.function)
(method_definition name: (property_identifier) @definition)
; Class declarations
(class name: (_) @definition.class)
(class_declaration name: (_) @definition.class)
@@ -0,0 +1,49 @@
[
(array)
(object)
(arguments)
(formal_parameters)
(statement_block)
(switch_statement)
(switch_case)
(switch_default)
(object_pattern)
(class_body)
(named_imports)
(binary_expression)
(return_statement)
(template_substitution)
(export_clause)
(enum_declaration)
(interface_declaration)
(object_type)
(call_expression)
(assignment_expression)
(member_expression)
(lexical_declaration)
(variable_declaration)
(assignment_expression)
(if_statement)
(for_statement)
(for_in_statement)
(while_statement)
(do_statement)
(try_statement)
(with_statement)
(throw_statement)
(export_statement)
(import_statement)
] @indent
[
"}"
"]"
")"
] @outdent
+12
View File
@@ -0,0 +1,12 @@
display_name: "Vue"
indent_unit:
space: 2
brackets:
- start: "{"
end: "}"
- start: "["
end: "]"
- start: "("
end: ")"
- start: "<"
end: ">"
@@ -0,0 +1,7 @@
display_name: "XML"
indent_unit:
space: 2
comment_prefix: "<!--"
brackets:
- start: "<"
end: ">"
@@ -0,0 +1,4 @@
display_name: "YAML"
indent_unit:
space: 2
comment_prefix: "#"
@@ -0,0 +1,13 @@
[
(block_scalar)
((block_sequence_item) @item @indent (#not-one-line? @item))
(block_mapping_pair
key: (_) @key
!value
)
(block_mapping_pair
key: (_) @key
value: (_) @val
(#not-same-line? @key @val)
)
] @indent