Skip to content

Commit 17bb4a1

Browse files
pqnCopybara Bot
andauthored
Project import generated by Copybara. (#27)
GitOrigin-RevId: 4fe75b628e1f86f109e90d248206170f2fdf1701 Co-authored-by: Copybara Bot <[email protected]>
1 parent a4e44c0 commit 17bb4a1

File tree

6 files changed

+268
-19
lines changed

6 files changed

+268
-19
lines changed

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,23 @@ Queries try to follow the [conventions established by tree-sitter.](https://tree
7474

7575
Most captures also include documentation as `@doc`. `@definition.function` and `@definition.method` also capture `@codeium.parameters`.
7676

77-
| Top-level capture | Python | TypeScript | JavaScript | Go | Java | C++ | PHP | Ruby |
78-
| ------------------------- | ------ | ---------- | ---------- | --- | ---- | ------ | --- | ---- |
79-
| `@definition.class` | | | || | | | |
80-
| `@definition.function` | |[^3] | || N/A | | | N/A |
81-
| `@definition.method` | [^1] |[^3] | || |[^1] | | |
82-
| `@definition.constructor` | | | | N/A | | | | |
83-
| `@definition.interface` | N/A | | N/A | | | N/A || |
84-
| `@definition.namespace` | N/A | | N/A | N/A | N/A | | | N/A |
85-
| `@definition.module` | N/A | | N/A | N/A | N/A | | N/A | |
86-
| `@definition.type` | N/A | | N/A | | N/A | | | N/A |
87-
| `@definition.constant` | | | || | | | |
88-
| `@definition.enum` | | | || | | | N/A |
89-
| `@definition.import` | | | || | | N/A | |
90-
| `@definition.include` | N/A | N/A | N/A | N/A | N/A | | | N/A |
91-
| `@definition.package` | N/A | N/A | N/A | | | N/A | N/A | N/A |
92-
| `@reference.call` | | | || | | | |
93-
| `@reference.class` | [^2] | | || | | | |
77+
| Top-level capture | Python | TypeScript | JavaScript | Go | Java | C++ | PHP | Ruby | C# |
78+
| ------------------------- | ------ | ---------- | ---------- | --- | ---- | ----- | --- | ---- | --- |
79+
| `@definition.class` | | | || | | || |
80+
| `@definition.function` | |[^3] | || N/A | | | N/A | N/A |
81+
| `@definition.method` | [^1] |[^3] | || |[^1] | || |
82+
| `@definition.constructor` | | | | N/A | | | || |
83+
| `@definition.interface` | N/A | | N/A | | | N/A ||| |
84+
| `@definition.namespace` | N/A | | N/A | N/A | N/A | | | N/A | |
85+
| `@definition.module` | N/A | | N/A | N/A | N/A | | N/A | | N/A |
86+
| `@definition.type` | N/A | | N/A | | N/A | | | N/A | N/A |
87+
| `@definition.constant` | | | || | | || |
88+
| `@definition.enum` | | | || | | | N/A | |
89+
| `@definition.import` | | | || | | N/A | | |
90+
| `@definition.include` | N/A | N/A | N/A | N/A | N/A | | | N/A | N/A |
91+
| `@definition.package` | N/A | N/A | N/A | | | N/A | N/A | N/A | N/A |
92+
| `@reference.call` | | | || | | || |
93+
| `@reference.class` | [^2] | | || | | || |
9494

9595
| Language | Supported injections |
9696
| -------- | ---------------------- |

download_parse.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -euo pipefail
33

44
cd "$(dirname "${BASH_SOURCE[0]}")"
5-
VERSION="v0.0.13"
5+
VERSION="v0.0.14"
66
rm -f parse.gz parse
77
curl -Lo parse.gz "https://github.com/Exafunction/codeium-parse/releases/download/$VERSION/parse.gz"
88
gzip -d parse.gz

goldens.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -euo pipefail
2+
set -euxo pipefail
33

44
cd "$(dirname "${BASH_SOURCE[0]}")"
55
for test_file in test_files/*; do

goldens/test.cs.golden

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
Name: Namespace
2+
Definition (definition.namespace):
3+
namespace Namespace {
4+
// Comment A.
5+
internal delegate void A(params int[] test);
6+
// Comment F.
7+
public struct F<T>
8+
where T : struct {
9+
}
10+
// Comment F.
11+
[Nice]
12+
private record F<T1, T2>
13+
where T1 : I1, I2, new()
14+
where T2 : I2 {}
15+
// Comment Teacher.
16+
record Teacher(string FirstName, string LastName, string Subject) : Person(FirstName, LastName);
17+
// Comment B.
18+
enum B { Ten = 10, Twenty = 20 }
19+
// Comment F.
20+
public class F : object, IAlpha, IOmega {}
21+
// Comment Class.
22+
public partial class Class<in TParam>
23+
where TParam : class ?, notnull, F ? {
24+
// Comment operator +.
25+
public static int operator +(A a) {
26+
return 0;
27+
}
28+
// Comment GetSet.
29+
uint GetSet { get; set; }
30+
// Comment Foo.
31+
static extern Foo() => bar = 0;
32+
// Comment ~Class.
33+
extern ~Class() {}
34+
// Comment Bar
35+
public void Bar() => bar = 0;
36+
}
37+
}
38+
39+
Name: F
40+
Doc:
41+
// Comment F.
42+
Definition (definition.class):
43+
public struct F<T>
44+
where T : struct {
45+
}
46+
Lineage: [Namespace]
47+
Lineage types: [namespace]
48+
49+
Name: F
50+
Doc:
51+
// Comment F.
52+
Definition (definition.class):
53+
[Nice]
54+
private record F<T1, T2>
55+
where T1 : I1, I2, new()
56+
where T2 : I2 {}
57+
Lineage: [Namespace]
58+
Lineage types: [namespace]
59+
60+
Name: Teacher
61+
Doc:
62+
// Comment Teacher.
63+
Declaration (definition.class):
64+
record Teacher(string FirstName, string LastName, string Subject) : Person(FirstName, LastName);
65+
Lineage: [Namespace]
66+
Lineage types: [namespace]
67+
68+
Name: B
69+
Doc:
70+
// Comment B.
71+
Definition (definition.enum):
72+
enum B { Ten = 10, Twenty = 20 }
73+
Lineage: [Namespace]
74+
Lineage types: [namespace]
75+
76+
Name: F
77+
Doc:
78+
// Comment F.
79+
Definition (definition.class):
80+
public class F : object, IAlpha, IOmega {}
81+
Lineage: [Namespace]
82+
Lineage types: [namespace]
83+
84+
Name: Class
85+
Doc:
86+
// Comment Class.
87+
Definition (definition.class):
88+
public partial class Class<in TParam>
89+
where TParam : class ?, notnull, F ? {
90+
// Comment operator +.
91+
public static int operator +(A a) {
92+
return 0;
93+
}
94+
// Comment GetSet.
95+
uint GetSet { get; set; }
96+
// Comment Foo.
97+
static extern Foo() => bar = 0;
98+
// Comment ~Class.
99+
extern ~Class() {}
100+
// Comment Bar
101+
public void Bar() => bar = 0;
102+
}
103+
Lineage: [Namespace]
104+
Lineage types: [namespace]
105+
106+
Name: +
107+
Doc:
108+
// Comment operator +.
109+
Definition (definition.method):
110+
public static int operator +(A a) {
111+
return 0;
112+
}
113+
Lineage: [Namespace Class]
114+
Lineage types: [namespace class]
115+
116+
Name: Foo
117+
Doc:
118+
// Comment Foo.
119+
Definition (definition.constructor):
120+
static extern Foo() => bar = 0;
121+
Lineage: [Namespace Class]
122+
Lineage types: [namespace class]
123+
124+
Name: Class
125+
Doc:
126+
// Comment ~Class.
127+
Definition (definition.destructor):
128+
extern ~Class() {}
129+
Lineage: [Namespace Class]
130+
Lineage types: [namespace class]
131+
132+
Name: Bar
133+
Doc:
134+
// Comment Bar
135+
Definition (definition.method):
136+
public void Bar() => bar = 0;
137+
Lineage: [Namespace Class]
138+
Lineage types: [namespace class]

queries/csharp_tags.scm

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
(file_scoped_namespace_declaration
2+
name: (identifier) @name) @definition.namespace
3+
(namespace_declaration
4+
name: (identifier) @name) @definition.namespace
5+
6+
(
7+
(comment)* @doc
8+
.
9+
(struct_declaration
10+
name: (identifier) @name
11+
body: (declaration_list) @body) @definition.class
12+
(#select-adjacent! @doc @definition.class)
13+
)
14+
15+
(
16+
(comment)* @doc
17+
.
18+
(record_declaration
19+
name: (identifier) @name
20+
body: (declaration_list)? @body) @definition.class
21+
(#select-adjacent! @doc @definition.class)
22+
)
23+
24+
(
25+
(comment)* @doc
26+
.
27+
(enum_declaration
28+
name: (identifier) @name
29+
body: (enum_member_declaration_list) @body) @definition.enum
30+
(#select-adjacent! @doc @definition.enum)
31+
)
32+
33+
(
34+
(comment)* @doc
35+
.
36+
(class_declaration
37+
name: (identifier) @name
38+
body: (declaration_list) @body) @definition.class
39+
(#select-adjacent! @doc @definition.class)
40+
)
41+
42+
(
43+
(comment)* @doc
44+
.
45+
(operator_declaration
46+
operator: _ @name
47+
body: (_) @body) @definition.method
48+
(#select-adjacent! @doc @definition.method)
49+
)
50+
51+
(
52+
(comment)* @doc
53+
.
54+
(constructor_declaration
55+
name: (identifier) @name
56+
body: (_) @body) @definition.constructor
57+
(#select-adjacent! @doc @definition.constructor)
58+
)
59+
60+
(
61+
(comment)* @doc
62+
.
63+
(destructor_declaration
64+
name: (identifier) @name
65+
body: (_) @body) @definition.destructor
66+
(#select-adjacent! @doc @definition.destructor)
67+
)
68+
69+
(
70+
(comment)* @doc
71+
.
72+
(method_declaration
73+
name: (identifier) @name
74+
body: (_) @body) @definition.method
75+
(#select-adjacent! @doc @definition.method)
76+
)

test_files/test.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
namespace Namespace {
2+
// Comment A.
3+
internal delegate void A(params int[] test);
4+
// Comment F.
5+
public struct F<T>
6+
where T : struct {
7+
}
8+
// Comment F.
9+
[Nice]
10+
private record F<T1, T2>
11+
where T1 : I1, I2, new()
12+
where T2 : I2 {}
13+
// Comment Teacher.
14+
record Teacher(string FirstName, string LastName, string Subject) : Person(FirstName, LastName);
15+
// Comment B.
16+
enum B { Ten = 10, Twenty = 20 }
17+
// Comment F.
18+
public class F : object, IAlpha, IOmega {}
19+
// Comment Class.
20+
public partial class Class<in TParam>
21+
where TParam : class ?, notnull, F ? {
22+
// Comment operator +.
23+
public static int operator +(A a) {
24+
return 0;
25+
}
26+
// Comment GetSet.
27+
uint GetSet { get; set; }
28+
// Comment Foo.
29+
static extern Foo() => bar = 0;
30+
// Comment ~Class.
31+
extern ~Class() {}
32+
// Comment Bar
33+
public void Bar() => bar = 0;
34+
}
35+
}

0 commit comments

Comments
 (0)