aboutsummaryrefslogtreecommitdiffstats
path: root/queries/c_sharp
diff options
context:
space:
mode:
authorSteve Vermeulen <sfvermeulen@gmail.com>2020-07-18 16:21:20 -0700
committerThomas Vigouroux <39092278+vigoux@users.noreply.github.com>2020-07-20 23:19:18 +0200
commit4d71e1455c1c2ffb9cdae4d9b7c9b472f6a5cbfa (patch)
tree03fc8992edc52a18f8d0fa15a5cbbb827bdfff2e /queries/c_sharp
parentC highlights: Add operator "%" (diff)
downloadnvim-treesitter-4d71e1455c1c2ffb9cdae4d9b7c9b472f6a5cbfa.tar
nvim-treesitter-4d71e1455c1c2ffb9cdae4d9b7c9b472f6a5cbfa.tar.gz
nvim-treesitter-4d71e1455c1c2ffb9cdae4d9b7c9b472f6a5cbfa.tar.bz2
nvim-treesitter-4d71e1455c1c2ffb9cdae4d9b7c9b472f6a5cbfa.tar.lz
nvim-treesitter-4d71e1455c1c2ffb9cdae4d9b7c9b472f6a5cbfa.tar.xz
nvim-treesitter-4d71e1455c1c2ffb9cdae4d9b7c9b472f6a5cbfa.tar.zst
nvim-treesitter-4d71e1455c1c2ffb9cdae4d9b7c9b472f6a5cbfa.zip
Added first attempt at highlighting and text objects for csharp
Diffstat (limited to 'queries/c_sharp')
-rw-r--r--queries/c_sharp/highlights.scm132
-rw-r--r--queries/c_sharp/textobjects.scm4
2 files changed, 136 insertions, 0 deletions
diff --git a/queries/c_sharp/highlights.scm b/queries/c_sharp/highlights.scm
new file mode 100644
index 000000000..b929a0f45
--- /dev/null
+++ b/queries/c_sharp/highlights.scm
@@ -0,0 +1,132 @@
+
+(method_declaration
+ name: (identifier) @method)
+
+(parameter_list
+ (parameter
+ name: (identifier) @parameter))
+
+[
+ (integer_literal)
+ (real_literal)
+] @number
+
+(null_literal) @constant.builtin
+(character_literal) @character
+
+[
+ (string_literal)
+ (interpolated_string_text)
+] @string
+
+(boolean_literal) @boolean
+
+[
+ (predefined_type)
+ (implicit_type)
+ (void_keyword)
+] @type.builtin
+
+(comment) @comment
+
+(using_directive
+ (identifier) @type)
+
+(using_directive
+ (qualified_name
+ (identifier) @type))
+
+(interface_declaration
+ name: (identifier) @type)
+(class_declaration
+ name: (identifier) @type)
+(enum_declaration
+ name: (identifier) @type)
+(constructor_declaration
+ name: (identifier) @type)
+(variable_declaration
+ (identifier) @type)
+
+(object_creation_expression
+ (identifier) @type)
+
+(attribute
+ name: (identifier) @attribute)
+
+[
+ "if"
+ "else"
+ "switch"
+ "case"
+] @conditional
+
+[
+ "while"
+ "for"
+ "do"
+ "continue"
+ "break"
+ "goto"
+ "foreach"
+] @repeat
+
+[
+ "try"
+ "catch"
+ "throw"
+ "finally"
+] @exception
+
+[
+ ";"
+ "."
+ ","
+ ":"
+] @punctuation.delimiter
+
+[
+ "["
+ "]"
+ "{"
+ "}"
+ "("
+ ")"
+] @punctuation.bracket
+
+[
+ "using"
+ "lock"
+ "params"
+ "ref"
+ "sizeof"
+ "operator"
+ "is"
+ "as"
+ "new"
+ "default"
+ "yield"
+ "return"
+ "typeof"
+ "abstract"
+ "const"
+ "extern"
+ "internal"
+ "override"
+ "private"
+ "protected"
+ "public"
+ "readonly"
+ "sealed"
+ "static"
+ "virtual"
+ "volatile"
+ "async"
+ "await"
+ "class"
+ "delegate"
+ "enum"
+ "interface"
+ "namespace"
+ "struct"
+] @keyword
+
diff --git a/queries/c_sharp/textobjects.scm b/queries/c_sharp/textobjects.scm
new file mode 100644
index 000000000..721439b97
--- /dev/null
+++ b/queries/c_sharp/textobjects.scm
@@ -0,0 +1,4 @@
+
+(method_declaration
+ body: (block) ? @function.inner) @function.outer
+