Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions extension.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ language = "CSharp"
name = "Roslyn"
language = "CSharp"

snippets = ["./languages/csharp/snippets/csharp.json"]

[grammars.c_sharp]
repository = "https://github.com/tree-sitter/tree-sitter-c-sharp"
commit = "485f0bae0274ac9114797fc10db6f7034e4086e3"
1 change: 1 addition & 0 deletions languages/csharp/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ code_fence_block_name = "csharp"
grammar = "c_sharp"
path_suffixes = ["cs"]
line_comments = ["// ", "/// "]
block_comment = ["/*", "*/"]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "{", end = "}", close = true, newline = true },
Expand Down
45 changes: 45 additions & 0 deletions languages/csharp/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
(class_declaration
body: (_ "{" "}")) @fold

(struct_declaration
body: (_ "{" "}")) @fold

(interface_declaration
body: (_ "{" "}")) @fold

(enum_declaration
body: (_ "{" "}")) @fold

(record_declaration
body: (_ "{" "}")) @fold

(namespace_declaration
body: (_ "{" "}")) @fold

(method_declaration
body: (_ "{" "}")) @fold

(property_declaration
body: (_ "{" "}")) @fold

(accessor_list
"{" "}") @fold

(initializer_expression
"{" "}") @fold

(lambda_expression
body: (_ "{" "}")) @fold

(switch_statement
"{" "}") @fold

(preprocessor_if
("#if") @fold
("#endif") @fold) @fold

(preprocessor_region
("#region") @fold
("#endregion") @fold) @fold

(comment) @fold
62 changes: 62 additions & 0 deletions languages/csharp/locals.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
(method_declaration
body: (block) @local-scope)

(local_function_statement
body: (block) @local-scope)

(property_declaration
body: (_) @local-scope)

(accessor_declaration
body: (block) @local-scope)

(for_statement
body: (_) @local-scope)

(for_each_statement
body: (_) @local-scope)

(while_statement
body: (_) @local-scope)

(do_statement
body: (_) @local-scope)

(if_statement
body: (_) @local-scope)

(switch_statement
body: (_) @local-scope)

(using_statement
body: (_) @local-scope)

(lock_statement
body: (_) @local-scope)

(lambda_expression
body: (_) @local-scope)

(anonymous_method_expression
body: (_) @local-scope)

(variable_declaration
(variable_declarator
name: (identifier) @definition))

(parameter
name: (identifier) @definition)

(parameter
name: (identifier) @definition.parameter)

(for_each_statement
(identifier) @definition)

(from_clause
(identifier) @definition)

(let_clause
(identifier) @definition)

(identifier) @reference
9 changes: 9 additions & 0 deletions languages/csharp/overrides.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(string_literal) @string

(verbatim_string_literal) @string

(raw_string_literal) @string

(interpolated_string_expression) @string

(comment) @comment.inclusive
Loading