Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /Consiliency_treesitter-chunker /chunker /languages /cs_plugin.py
| from __future__ import annotations | |
| from typing import TYPE_CHECKING | |
| from chunker.utils.text import safe_decode_bytes | |
| from .plugin_base import LanguagePlugin | |
| if TYPE_CHECKING: | |
| from tree_sitter import Node | |
| class CSharpPlugin(LanguagePlugin): | |
| """Plugin for C# language chunking using tree-sitter-c-sharp node types.""" | |
| def language_name(self) -> str: | |
| return "c_sharp" | |
| def supported_extensions(self) -> set[str]: | |
| return {".cs", ".csx"} | |
| def default_chunk_types(self) -> set[str]: | |
| return { | |
| "class_declaration", | |
| "struct_declaration", | |
| "interface_declaration", | |
| "enum_declaration", | |
| "method_declaration", | |
| "constructor_declaration", | |
| "property_declaration", | |
| "field_declaration", | |
| "record_declaration", | |
| } | |
| def get_node_name(node: Node, source: bytes) -> str | None: | |
| for child in node.children: | |
| if child.type == "identifier": | |
| return safe_decode_bytes(source[child.start_byte : child.end_byte]) | |
| return None | |
Xet Storage Details
- Size:
- 1.17 kB
- Xet hash:
- ce190a1394659b4c1288fa8e23ecf9d08c64c57fdd859bf2f2dabf83da8726ba
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.