(setq-local treesit-thing-settings
`((c-sharp
+ (list
+ ,(rx bos (or "global_attribute"
+ "attribute_argument_list"
+ "attribute_list"
+ "enum_member_declaration_list"
+ "type_parameter_list"
+ "declaration_list"
+ "accessor_list"
+ "bracketed_parameter_list"
+ "parameter_list"
+ "argument_list"
+ "tuple_pattern"
+ "block"
+ "bracketed_argument_list"
+ "type_argument_list"
+ "array_rank_specifier"
+ "function_pointer_type"
+ "tuple_type"
+ "_for_statement_conditions"
+ "switch_body"
+ "catch_declaration"
+ "catch_filter_clause"
+ "parenthesized_pattern"
+ "list_pattern"
+ "positional_pattern_clause"
+ "property_pattern_clause"
+ "parenthesized_variable_designation"
+ "_switch_expression_body"
+ "interpolated_string_expression"
+ "interpolation"
+ "parenthesized_expression"
+ "_parenthesized_lvalue_expression"
+ "anonymous_object_creation_expression"
+ "initializer_expression"
+ "_with_body"
+ "tuple_expression"
+ "preproc_parenthesized_expression")
+ eos))
+ (sentence
+ ,(rx bos (or "extern_alias_directive"
+ "using_directive"
+ "file_scoped_namespace_declaration"
+ "enum_declaration"
+ "delegate_declaration"
+ "_declaration_list_body"
+ "field_declaration"
+ "event_declaration"
+ "event_field_declaration"
+ "indexer_declaration"
+ "property_declaration"
+ "_function_body"
+ "break_statement"
+ "continue_statement"
+ "do_statement"
+ "empty_statement"
+ "expression_statement"
+ "return_statement"
+ "yield_statement"
+ "throw_statement"
+ "goto_statement"
+ "local_declaration_statement")
+ eos))
(text
,(regexp-opt '("comment"
"verbatim_string-literal"
("Struct" "\\`struct_declaration\\'" nil nil)
("Method" "\\`method_declaration\\'" nil nil)))
+ ;; Outline minor mode.
+ (setq-local treesit-outline-predicate
+ (rx bos (or "namespace_declaration"
+ "class_declaration"
+ "interface_declaration"
+ "enum_declaration"
+ "record_declaration"
+ "struct_declaration"
+ "method_declaration"
+ "local_function_statement")
+ eos))
+
(treesit-major-mode-setup)
(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-ts-mode)))
"type_declaration")))
(setq-local treesit-defun-name-function #'go-ts-mode--defun-name)
+ (setq-local treesit-thing-settings
+ `((go
+ (list
+ ,(rx bos (or "import_spec_list"
+ "var_spec_list"
+ "type_parameter_list"
+ "parameter_list"
+ "parenthesized_type"
+ "type_arguments"
+ "field_declaration_list"
+ "block"
+ "parenthesized_expression"
+ "special_argument_list"
+ "argument_list"
+ "literal_value")
+ eos))
+ (sentence
+ (or "declaration" "statement")))))
+
;; Imenu.
(setq-local treesit-simple-imenu-settings
`(("Function" "\\`function_declaration\\'" nil nil)
`((php
(defun ,treesit-defun-type-regexp)
(sexp (not ,(rx (or "{" "}" "[" "]" "(" ")" ","))))
+ (list
+ ,(rx bos (or "namespace_use_group"
+ "enum_declaration_list"
+ "declaration_list"
+ "property_hook_list"
+ "use_list"
+ "anonymous_function_use_clause"
+ "formal_parameters"
+ "match_block"
+ "switch_block"
+ "compound_statement"
+ "parenthesized_expression"
+ "_array_destructing"
+ "arguments"
+ "_complex_string_part")
+ eos))
(sentence ,(regexp-opt
'("break_statement"
"case_statement"
"struct_item")))
(setq-local treesit-defun-name-function #'rust-ts-mode--defun-name)
+ (setq-local treesit-thing-settings
+ `((rust
+ (list
+ ,(rx bos (or "token_tree_pattern"
+ "token_tree"
+ "attribute_item"
+ "inner_attribute_item"
+ "declaration_list"
+ "enum_variant_list"
+ "field_declaration_list"
+ "ordered_field_declaration_list"
+ "type_parameters"
+ "use_list"
+ "parameters"
+ "bracketed_type"
+ "array_type"
+ "for_lifetimes"
+ "tuple_type"
+ "unit_type"
+ "use_bounds"
+ "type_arguments"
+ "delim_token_tree"
+ "arguments"
+ "array_expression"
+ "parenthesized_expression"
+ "tuple_expression"
+ "unit_expression"
+ "field_initializer_list"
+ "match_block"
+ "block"
+ "tuple_pattern"
+ "slice_pattern")
+ eos)))))
+
(treesit-major-mode-setup)))
(derived-mode-add-parents 'rust-ts-mode '(rust-mode))