diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index ee719b568..a1fbf1724 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -1,11 +1,11 @@ | Language | Syntax Highlighting | Treesitter Textobjects | Auto Indent | Default LSP | | --- | --- | --- | --- | --- | | bash | ✓ | | | `bash-language-server` | -| c | ✓ | | | `clangd` | +| c | ✓ | ✓ | ✓ | `clangd` | | c-sharp | ✓ | | | | | cmake | ✓ | ✓ | ✓ | `cmake-language-server` | | comment | ✓ | | | | -| cpp | ✓ | | | `clangd` | +| cpp | ✓ | ✓ | ✓ | `clangd` | | css | ✓ | | | | | dart | ✓ | | ✓ | `dart` | | dockerfile | ✓ | | | `docker-langserver` | diff --git a/runtime/queries/c/indents.toml b/runtime/queries/c/indents.toml new file mode 100644 index 000000000..f4076e171 --- /dev/null +++ b/runtime/queries/c/indents.toml @@ -0,0 +1,16 @@ +indent = [ + "compound_statement", + "field_declaration_list", + "enumerator_list", + "parameter_list", + "init_declarator", + "case_statement", + "condition_clause", + "expression_statement", +] + +outdent = [ + "case", + "}", + "]", +] diff --git a/runtime/queries/c/textobjects.scm b/runtime/queries/c/textobjects.scm new file mode 100644 index 000000000..b0f036685 --- /dev/null +++ b/runtime/queries/c/textobjects.scm @@ -0,0 +1,13 @@ +(function_definition + body: (_) @function.inside) @function.around + +(struct_specifier + body: (_) @class.inside) @class.around + +(enum_specifier + body: (_) @class.inside) @class.around + +(union_specifier + body: (_) @class.inside) @class.around + +(parameter_declaration) @parameter.inside diff --git a/runtime/queries/cpp/indents.toml b/runtime/queries/cpp/indents.toml new file mode 100644 index 000000000..0ca2ed8bf --- /dev/null +++ b/runtime/queries/cpp/indents.toml @@ -0,0 +1,17 @@ +indent = [ + "compound_statement", + "field_declaration_list", + "enumerator_list", + "parameter_list", + "init_declarator", + "case_statement", + "condition_clause", + "expression_statement", +] + +outdent = [ + "case", + "access_specifier", + "}", + "]", +] diff --git a/runtime/queries/cpp/textobjects.scm b/runtime/queries/cpp/textobjects.scm new file mode 100644 index 000000000..6e3de1a2c --- /dev/null +++ b/runtime/queries/cpp/textobjects.scm @@ -0,0 +1,7 @@ +; inherits: c + +(lambda_expression + body: (_) @function.inside) @function.around + +(class_specifier + body: (_) @class.inside) @class.around