Skip to content
This repository was archived by the owner on Nov 2, 2025. It is now read-only.
Merged
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
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,23 @@ Queries try to follow the [conventions established by tree-sitter.](https://tree

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

| Top-level capture | Python | TypeScript | JavaScript | Go | Java | C++ | PHP | Ruby |
| ------------------------- | ------ | ---------- | ---------- | --- | ---- | ------ | --- | ---- |
| `@definition.class` | | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| `@definition.function` | | ✅[^3] | ✅ | ✅ | N/A | | | N/A |
| `@definition.method` | [^1] | ✅[^3] | ✅ | ✅ | ✅ | ✅[^1] | ✅ | ✅ |
| `@definition.constructor` | | ✅ | ✅ | N/A | | ❌ | ❌ | ❌ |
| `@definition.interface` | N/A | | N/A | ✅ | ✅ | N/A | ✅ | ❌ |
| `@definition.namespace` | N/A | | N/A | N/A | N/A | | | N/A |
| `@definition.module` | N/A | | N/A | N/A | N/A | | N/A | |
| `@definition.type` | N/A | | N/A | | N/A | | | N/A |
| `@definition.constant` | | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
| `@definition.enum` | | ❌ | ❌ | ❌ | ❌ | ❌ | | N/A |
| `@definition.import` | | ✅ | ✅ | ❌ | ❌ | ❌ | N/A | |
| `@definition.include` | N/A | N/A | N/A | N/A | N/A | | | N/A |
| `@definition.package` | N/A | N/A | N/A | ✅ | ✅ | N/A | N/A | N/A |
| `@reference.call` | | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ |
| `@reference.class` | [^2] | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Top-level capture | Python | TypeScript | JavaScript | Go | Java | C++ | PHP | Ruby | C# |
| ------------------------- | ------ | ---------- | ---------- | --- | ---- | ----- | --- | ---- | --- |
| `@definition.class` | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| `@definition.function` | | ✓[^3] | ✓ | ✓ | N/A | | ✓ | N/A | N/A |
| `@definition.method` | [^1] | ✓[^3] | ✓ | ✓ | ✓ | ✓[^1] | ✓ | ✓ | ✓ |
| `@definition.constructor` | | ✓ | ✓ | N/A | | ✗ | ✗ | ✗ | ✓ |
| `@definition.interface` | N/A | | N/A | ✓ | ✓ | N/A | ✓ | ✗ | ✗ |
| `@definition.namespace` | N/A | | N/A | N/A | N/A | | | N/A | ✓ |
| `@definition.module` | N/A | | N/A | N/A | N/A | | N/A | ✓ | N/A |
| `@definition.type` | N/A | | N/A | | N/A | | ✗ | N/A | N/A |
| `@definition.constant` | | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
| `@definition.enum` | | ✗ | ✗ | ✗ | ✗ | ✗ | | N/A | ✓ |
| `@definition.import` | | ✓ | ✓ | ✗ | ✗ | ✗ | N/A | ✓ | ✗ |
| `@definition.include` | N/A | N/A | N/A | N/A | N/A | | ✗ | N/A | N/A |
| `@definition.package` | N/A | N/A | N/A | ✓ | ✓ | N/A | N/A | N/A | N/A |
| `@reference.call` | | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ | ✓ | ✗ |
| `@reference.class` | [^2] | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ |

| Language | Supported injections |
| -------- | ---------------------- |
Expand Down
2 changes: 1 addition & 1 deletion download_parse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -euo pipefail

cd "$(dirname "${BASH_SOURCE[0]}")"
VERSION="v0.0.13"
VERSION="v0.0.14"
rm -f parse.gz parse
curl -Lo parse.gz "https://github.com/Exafunction/codeium-parse/releases/download/$VERSION/parse.gz"
gzip -d parse.gz
Expand Down
2 changes: 1 addition & 1 deletion goldens.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -euo pipefail
set -euxo pipefail

cd "$(dirname "${BASH_SOURCE[0]}")"
for test_file in test_files/*; do
Expand Down
138 changes: 138 additions & 0 deletions goldens/test.cs.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
Name: Namespace
Definition (definition.namespace):
namespace Namespace {
// Comment A.
internal delegate void A(params int[] test);
// Comment F.
public struct F<T>
where T : struct {
}
// Comment F.
[Nice]
private record F<T1, T2>
where T1 : I1, I2, new()
where T2 : I2 {}
// Comment Teacher.
record Teacher(string FirstName, string LastName, string Subject) : Person(FirstName, LastName);
// Comment B.
enum B { Ten = 10, Twenty = 20 }
// Comment F.
public class F : object, IAlpha, IOmega {}
// Comment Class.
public partial class Class<in TParam>
where TParam : class ?, notnull, F ? {
// Comment operator +.
public static int operator +(A a) {
return 0;
}
// Comment GetSet.
uint GetSet { get; set; }
// Comment Foo.
static extern Foo() => bar = 0;
// Comment ~Class.
extern ~Class() {}
// Comment Bar
public void Bar() => bar = 0;
}
}

Name: F
Doc:
// Comment F.
Definition (definition.class):
public struct F<T>
where T : struct {
}
Lineage: [Namespace]
Lineage types: [namespace]

Name: F
Doc:
// Comment F.
Definition (definition.class):
[Nice]
private record F<T1, T2>
where T1 : I1, I2, new()
where T2 : I2 {}
Lineage: [Namespace]
Lineage types: [namespace]

Name: Teacher
Doc:
// Comment Teacher.
Declaration (definition.class):
record Teacher(string FirstName, string LastName, string Subject) : Person(FirstName, LastName);
Lineage: [Namespace]
Lineage types: [namespace]

Name: B
Doc:
// Comment B.
Definition (definition.enum):
enum B { Ten = 10, Twenty = 20 }
Lineage: [Namespace]
Lineage types: [namespace]

Name: F
Doc:
// Comment F.
Definition (definition.class):
public class F : object, IAlpha, IOmega {}
Lineage: [Namespace]
Lineage types: [namespace]

Name: Class
Doc:
// Comment Class.
Definition (definition.class):
public partial class Class<in TParam>
where TParam : class ?, notnull, F ? {
// Comment operator +.
public static int operator +(A a) {
return 0;
}
// Comment GetSet.
uint GetSet { get; set; }
// Comment Foo.
static extern Foo() => bar = 0;
// Comment ~Class.
extern ~Class() {}
// Comment Bar
public void Bar() => bar = 0;
}
Lineage: [Namespace]
Lineage types: [namespace]

Name: +
Doc:
// Comment operator +.
Definition (definition.method):
public static int operator +(A a) {
return 0;
}
Lineage: [Namespace Class]
Lineage types: [namespace class]

Name: Foo
Doc:
// Comment Foo.
Definition (definition.constructor):
static extern Foo() => bar = 0;
Lineage: [Namespace Class]
Lineage types: [namespace class]

Name: Class
Doc:
// Comment ~Class.
Definition (definition.destructor):
extern ~Class() {}
Lineage: [Namespace Class]
Lineage types: [namespace class]

Name: Bar
Doc:
// Comment Bar
Definition (definition.method):
public void Bar() => bar = 0;
Lineage: [Namespace Class]
Lineage types: [namespace class]
76 changes: 76 additions & 0 deletions queries/csharp_tags.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
(file_scoped_namespace_declaration
name: (identifier) @name) @definition.namespace
(namespace_declaration
name: (identifier) @name) @definition.namespace

(
(comment)* @doc
.
(struct_declaration
name: (identifier) @name
body: (declaration_list) @body) @definition.class
(#select-adjacent! @doc @definition.class)
)

(
(comment)* @doc
.
(record_declaration
name: (identifier) @name
body: (declaration_list)? @body) @definition.class
(#select-adjacent! @doc @definition.class)
)

(
(comment)* @doc
.
(enum_declaration
name: (identifier) @name
body: (enum_member_declaration_list) @body) @definition.enum
(#select-adjacent! @doc @definition.enum)
)

(
(comment)* @doc
.
(class_declaration
name: (identifier) @name
body: (declaration_list) @body) @definition.class
(#select-adjacent! @doc @definition.class)
)

(
(comment)* @doc
.
(operator_declaration
operator: _ @name
body: (_) @body) @definition.method
(#select-adjacent! @doc @definition.method)
)

(
(comment)* @doc
.
(constructor_declaration
name: (identifier) @name
body: (_) @body) @definition.constructor
(#select-adjacent! @doc @definition.constructor)
)

(
(comment)* @doc
.
(destructor_declaration
name: (identifier) @name
body: (_) @body) @definition.destructor
(#select-adjacent! @doc @definition.destructor)
)

(
(comment)* @doc
.
(method_declaration
name: (identifier) @name
body: (_) @body) @definition.method
(#select-adjacent! @doc @definition.method)
)
35 changes: 35 additions & 0 deletions test_files/test.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace Namespace {
// Comment A.
internal delegate void A(params int[] test);
// Comment F.
public struct F<T>
where T : struct {
}
// Comment F.
[Nice]
private record F<T1, T2>
where T1 : I1, I2, new()
where T2 : I2 {}
// Comment Teacher.
record Teacher(string FirstName, string LastName, string Subject) : Person(FirstName, LastName);
// Comment B.
enum B { Ten = 10, Twenty = 20 }
// Comment F.
public class F : object, IAlpha, IOmega {}
// Comment Class.
public partial class Class<in TParam>
where TParam : class ?, notnull, F ? {
// Comment operator +.
public static int operator +(A a) {
return 0;
}
// Comment GetSet.
uint GetSet { get; set; }
// Comment Foo.
static extern Foo() => bar = 0;
// Comment ~Class.
extern ~Class() {}
// Comment Bar
public void Bar() => bar = 0;
}
}