Skip to content

Base

Base configuration for language-specific syntax chunking.

This module provides the base configuration class for defining how different programming languages map their syntax elements to code chunks.

LanguageConfig dataclass

Configuration for language-specific syntax chunking.

This class defines how a specific programming language's syntax elements map to different types of code chunks. Each field is a list of syntax node types that represent that kind of entity in the language's AST.

Source code in src/codemap/processor/tree_sitter/languages/base.py
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
@dataclass(frozen=True)
class LanguageConfig:
	"""
	Configuration for language-specific syntax chunking.

	This class defines how a specific programming language's syntax
	elements map to different types of code chunks. Each field is a list of
	syntax node types that represent that kind of entity in the language's
	AST.

	"""

	# File-level entities
	module: ClassVar[list[str]]
	"""Node types that represent entire modules/files."""

	namespace: ClassVar[list[str]]
	"""Node types for namespace/package declarations."""

	# Type definitions
	class_: ClassVar[list[str]]
	"""Node types for class definitions."""

	interface: ClassVar[list[str]]
	"""Node types for interface definitions."""

	protocol: ClassVar[list[str]]
	"""Node types for protocol/trait definitions."""

	struct: ClassVar[list[str]]
	"""Node types for struct definitions."""

	enum: ClassVar[list[str]]
	"""Node types for enum declarations."""

	type_alias: ClassVar[list[str]]
	"""Node types for type aliases/typedefs."""

	# Functions and methods
	function: ClassVar[list[str]]
	"""Node types for function declarations."""

	method: ClassVar[list[str]]
	"""Node types for method declarations."""

	property_def: ClassVar[list[str]]
	"""Node types for property/getter/setter declarations."""

	test_case: ClassVar[list[str]]
	"""Node types that identify test functions."""

	test_suite: ClassVar[list[str]]
	"""Node types that identify test classes/suites."""

	# Variables and constants
	variable: ClassVar[list[str]]
	"""Node types for variable declarations."""

	constant: ClassVar[list[str]]
	"""Node types for constant declarations."""

	class_field: ClassVar[list[str]]
	"""Node types for class field declarations."""

	# Code organization
	import_: ClassVar[list[str]]
	"""Node types for import statements."""

	decorator: ClassVar[list[str]]
	"""Node types for decorators/annotations."""

	# Documentation
	comment: ClassVar[list[str]]
	"""Node types for general comments."""

	docstring: ClassVar[list[str]]
	"""Node types for documentation strings."""

	# Language-specific metadata
	file_extensions: ClassVar[list[str]]
	"""File extensions associated with this language (e.g., ['.py', '.pyi'])."""

	tree_sitter_name: ClassVar[str] = ""
	"""Tree-sitter language identifier."""

	# Optional node types that might be language-specific
	decorators: ClassVar[list[str] | None] = None
	class_fields: ClassVar[list[str] | None] = None

	@property
	def all_node_types(self) -> set[str]:
		"""
		Get all node types defined in this configuration.

		Returns:
		    A set of all node types from all categories.

		"""
		all_types = set()
		for attr in [
			self.module,
			self.namespace,
			self.class_,
			self.interface,
			self.protocol,
			self.struct,
			self.enum,
			self.type_alias,
			self.function,
			self.method,
			self.property_def,
			self.test_case,
			self.test_suite,
			self.variable,
			self.constant,
			self.class_field,
			self.import_,
			self.decorator,
			self.comment,
			self.docstring,
			self.decorators,
			self.class_fields,
		]:
			if attr:  # Skip None values
				all_types.update(attr)
		return all_types

__init__

__init__() -> None

module class-attribute

module: list[str]

Node types that represent entire modules/files.

namespace class-attribute

namespace: list[str]

Node types for namespace/package declarations.

class_ class-attribute

class_: list[str]

Node types for class definitions.

interface class-attribute

interface: list[str]

Node types for interface definitions.

protocol class-attribute

protocol: list[str]

Node types for protocol/trait definitions.

struct class-attribute

struct: list[str]

Node types for struct definitions.

enum class-attribute

enum: list[str]

Node types for enum declarations.

type_alias class-attribute

type_alias: list[str]

Node types for type aliases/typedefs.

function class-attribute

function: list[str]

Node types for function declarations.

method class-attribute

method: list[str]

Node types for method declarations.

property_def class-attribute

property_def: list[str]

Node types for property/getter/setter declarations.

test_case class-attribute

test_case: list[str]

Node types that identify test functions.

test_suite class-attribute

test_suite: list[str]

Node types that identify test classes/suites.

variable class-attribute

variable: list[str]

Node types for variable declarations.

constant class-attribute

constant: list[str]

Node types for constant declarations.

class_field class-attribute

class_field: list[str]

Node types for class field declarations.

import_ class-attribute

import_: list[str]

Node types for import statements.

decorator class-attribute

decorator: list[str]

Node types for decorators/annotations.

comment class-attribute

comment: list[str]

Node types for general comments.

docstring class-attribute

docstring: list[str]

Node types for documentation strings.

file_extensions class-attribute

file_extensions: list[str]

File extensions associated with this language (e.g., ['.py', '.pyi']).

tree_sitter_name class-attribute

tree_sitter_name: str = ''

Tree-sitter language identifier.

decorators class-attribute

decorators: list[str] | None = None

class_fields class-attribute

class_fields: list[str] | None = None

all_node_types property

all_node_types: set[str]

Get all node types defined in this configuration.

Returns:

Type Description
set[str]

A set of all node types from all categories.

LanguageSyntaxHandler

Bases: ABC

Abstract base class for language-specific syntax handling.

Source code in src/codemap/processor/tree_sitter/languages/base.py
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
class LanguageSyntaxHandler(abc.ABC):
	"""Abstract base class for language-specific syntax handling."""

	def __init__(self, config: LanguageConfig) -> None:
		"""
		Initialize with language configuration.

		Args:
		    config: Language-specific configuration

		"""
		self.config = config

	@abc.abstractmethod
	def get_entity_type(self, node: Node, parent: Node | None, content_bytes: bytes) -> EntityType:
		"""
		Determine the EntityType for a given node.

		Args:
		    node: The tree-sitter node
		    parent: The parent node (if any)
		    content_bytes: Source code content as bytes

		Returns:
		    The entity type

		"""

	@abc.abstractmethod
	def find_docstring(self, node: Node, content_bytes: bytes) -> tuple[str | None, Node | None]:
		"""
		Find the docstring associated with a definition node.

		Args:
		    node: The tree-sitter node
		    content_bytes: Source code content as bytes

		Returns:
		    A tuple containing:
		    - The extracted docstring text (or None).
		    - The specific AST node representing the docstring that should be skipped
		      during child processing (or None).

		"""

	@abc.abstractmethod
	def extract_name(self, node: Node, content_bytes: bytes) -> str:
		"""
		Extract the name identifier from a definition node.

		Args:
		    node: The tree-sitter node
		    content_bytes: Source code content as bytes

		Returns:
		    The extracted name

		"""

	@abc.abstractmethod
	def get_body_node(self, node: Node) -> Node | None:
		"""
		Get the main body node for a function, method, or class.

		This should be overridden by subclasses to find the appropriate block node.

		Args:
		    node: The node representing the function, method, or class.

		Returns:
		    The body node, or None if not applicable/found.

		"""
		# Default implementation: returns None or the node itself as a naive fallback
		# Subclasses should find specific body nodes like 'block', 'statement_block' etc.
		return node  # Naive fallback - subclasses MUST override

	@abc.abstractmethod
	def get_children_to_process(self, node: Node, body_node: Node | None) -> list[Node]:
		"""
		Get the list of child nodes that should be recursively processed.

		Args:
		    node: The tree-sitter node
		    body_node: The body node if available

		Returns:
		    List of child nodes to process

		"""

	@abc.abstractmethod
	def should_skip_node(self, node: Node) -> bool:
		"""
		Determine if a node should be skipped entirely during processing.

		Args:
		    node: The tree-sitter node

		Returns:
		    True if the node should be skipped

		"""

	@abc.abstractmethod
	def extract_imports(self, node: Node, content_bytes: bytes) -> list[str]:
		"""
		Extract imported dependency names from an import node.

		Args:
		    node: The tree-sitter node (should be an import type)
		    content_bytes: Source code content as bytes

		Returns:
		    List of imported names

		"""

	@abc.abstractmethod
	def extract_calls(self, node: Node, content_bytes: bytes) -> list[str]:
		"""
		Extract names of functions/methods called within a node's scope.

		Args:
		    node: The tree-sitter node (e.g., function/method body)
		    content_bytes: Source code content as bytes

		Returns:
		    List of called function/method names

		"""

	def extract_signature(self, node: Node, content_bytes: bytes) -> str | None:
		"""
		Extract the signature (definition line without body) for a function, class, etc.

		Args:
		    node: The node to extract the signature from.
		    content_bytes: Source code content as bytes.

		Returns:
		    The signature string, or None if not applicable.

		"""
		# Default implementation: return the first line of the node's text
		try:
			first_line = content_bytes[node.start_byte : node.end_byte].split(b"\n", 1)[0]
			return first_line.decode("utf-8", errors="ignore").strip()
		except (IndexError, UnicodeDecodeError):
			# Catch specific errors related to slicing and decoding
			return None

	def get_enclosing_node_of_type(self, node: Node, target_type: EntityType) -> Node | None:
		"""
		Find the first ancestor node that matches the target entity type.

		Args:
		    node: The starting node.
		    target_type: The EntityType to search for in ancestors.

		Returns:
		    The ancestor node if found, otherwise None.

		"""
		current = node.parent
		while current:
			# We need content_bytes to determine the type accurately, but we don't have it here.
			# This highlights a limitation of doing this purely structurally without context.
			# Subclasses might need a different approach or access to the analyzer/content.
			# For a basic structural check:
			# entity_type = self.get_entity_type(current, current.parent, ???) # Need content_bytes
			# if entity_type == target_type:
			#    return current

			# Simplistic check based on node type name (less reliable)
			if target_type.name.lower() in current.type.lower():  # Very rough check
				return current
			current = current.parent
		return None

__init__

__init__(config: LanguageConfig) -> None

Initialize with language configuration.

Parameters:

Name Type Description Default
config LanguageConfig

Language-specific configuration

required
Source code in src/codemap/processor/tree_sitter/languages/base.py
153
154
155
156
157
158
159
160
161
def __init__(self, config: LanguageConfig) -> None:
	"""
	Initialize with language configuration.

	Args:
	    config: Language-specific configuration

	"""
	self.config = config

config instance-attribute

config = config

get_entity_type abstractmethod

get_entity_type(
	node: Node, parent: Node | None, content_bytes: bytes
) -> EntityType

Determine the EntityType for a given node.

Parameters:

Name Type Description Default
node Node

The tree-sitter node

required
parent Node | None

The parent node (if any)

required
content_bytes bytes

Source code content as bytes

required

Returns:

Type Description
EntityType

The entity type

Source code in src/codemap/processor/tree_sitter/languages/base.py
163
164
165
166
167
168
169
170
171
172
173
174
175
176
@abc.abstractmethod
def get_entity_type(self, node: Node, parent: Node | None, content_bytes: bytes) -> EntityType:
	"""
	Determine the EntityType for a given node.

	Args:
	    node: The tree-sitter node
	    parent: The parent node (if any)
	    content_bytes: Source code content as bytes

	Returns:
	    The entity type

	"""

find_docstring abstractmethod

find_docstring(
	node: Node, content_bytes: bytes
) -> tuple[str | None, Node | None]

Find the docstring associated with a definition node.

Parameters:

Name Type Description Default
node Node

The tree-sitter node

required
content_bytes bytes

Source code content as bytes

required

Returns:

Type Description
str | None

A tuple containing:

Node | None
  • The extracted docstring text (or None).
tuple[str | None, Node | None]
  • The specific AST node representing the docstring that should be skipped during child processing (or None).
Source code in src/codemap/processor/tree_sitter/languages/base.py
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
@abc.abstractmethod
def find_docstring(self, node: Node, content_bytes: bytes) -> tuple[str | None, Node | None]:
	"""
	Find the docstring associated with a definition node.

	Args:
	    node: The tree-sitter node
	    content_bytes: Source code content as bytes

	Returns:
	    A tuple containing:
	    - The extracted docstring text (or None).
	    - The specific AST node representing the docstring that should be skipped
	      during child processing (or None).

	"""

extract_name abstractmethod

extract_name(node: Node, content_bytes: bytes) -> str

Extract the name identifier from a definition node.

Parameters:

Name Type Description Default
node Node

The tree-sitter node

required
content_bytes bytes

Source code content as bytes

required

Returns:

Type Description
str

The extracted name

Source code in src/codemap/processor/tree_sitter/languages/base.py
195
196
197
198
199
200
201
202
203
204
205
206
207
@abc.abstractmethod
def extract_name(self, node: Node, content_bytes: bytes) -> str:
	"""
	Extract the name identifier from a definition node.

	Args:
	    node: The tree-sitter node
	    content_bytes: Source code content as bytes

	Returns:
	    The extracted name

	"""

get_body_node abstractmethod

get_body_node(node: Node) -> Node | None

Get the main body node for a function, method, or class.

This should be overridden by subclasses to find the appropriate block node.

Parameters:

Name Type Description Default
node Node

The node representing the function, method, or class.

required

Returns:

Type Description
Node | None

The body node, or None if not applicable/found.

Source code in src/codemap/processor/tree_sitter/languages/base.py
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
@abc.abstractmethod
def get_body_node(self, node: Node) -> Node | None:
	"""
	Get the main body node for a function, method, or class.

	This should be overridden by subclasses to find the appropriate block node.

	Args:
	    node: The node representing the function, method, or class.

	Returns:
	    The body node, or None if not applicable/found.

	"""
	# Default implementation: returns None or the node itself as a naive fallback
	# Subclasses should find specific body nodes like 'block', 'statement_block' etc.
	return node  # Naive fallback - subclasses MUST override

get_children_to_process abstractmethod

get_children_to_process(
	node: Node, body_node: Node | None
) -> list[Node]

Get the list of child nodes that should be recursively processed.

Parameters:

Name Type Description Default
node Node

The tree-sitter node

required
body_node Node | None

The body node if available

required

Returns:

Type Description
list[Node]

List of child nodes to process

Source code in src/codemap/processor/tree_sitter/languages/base.py
227
228
229
230
231
232
233
234
235
236
237
238
239
@abc.abstractmethod
def get_children_to_process(self, node: Node, body_node: Node | None) -> list[Node]:
	"""
	Get the list of child nodes that should be recursively processed.

	Args:
	    node: The tree-sitter node
	    body_node: The body node if available

	Returns:
	    List of child nodes to process

	"""

should_skip_node abstractmethod

should_skip_node(node: Node) -> bool

Determine if a node should be skipped entirely during processing.

Parameters:

Name Type Description Default
node Node

The tree-sitter node

required

Returns:

Type Description
bool

True if the node should be skipped

Source code in src/codemap/processor/tree_sitter/languages/base.py
241
242
243
244
245
246
247
248
249
250
251
252
@abc.abstractmethod
def should_skip_node(self, node: Node) -> bool:
	"""
	Determine if a node should be skipped entirely during processing.

	Args:
	    node: The tree-sitter node

	Returns:
	    True if the node should be skipped

	"""

extract_imports abstractmethod

extract_imports(
	node: Node, content_bytes: bytes
) -> list[str]

Extract imported dependency names from an import node.

Parameters:

Name Type Description Default
node Node

The tree-sitter node (should be an import type)

required
content_bytes bytes

Source code content as bytes

required

Returns:

Type Description
list[str]

List of imported names

Source code in src/codemap/processor/tree_sitter/languages/base.py
254
255
256
257
258
259
260
261
262
263
264
265
266
@abc.abstractmethod
def extract_imports(self, node: Node, content_bytes: bytes) -> list[str]:
	"""
	Extract imported dependency names from an import node.

	Args:
	    node: The tree-sitter node (should be an import type)
	    content_bytes: Source code content as bytes

	Returns:
	    List of imported names

	"""

extract_calls abstractmethod

extract_calls(
	node: Node, content_bytes: bytes
) -> list[str]

Extract names of functions/methods called within a node's scope.

Parameters:

Name Type Description Default
node Node

The tree-sitter node (e.g., function/method body)

required
content_bytes bytes

Source code content as bytes

required

Returns:

Type Description
list[str]

List of called function/method names

Source code in src/codemap/processor/tree_sitter/languages/base.py
268
269
270
271
272
273
274
275
276
277
278
279
280
@abc.abstractmethod
def extract_calls(self, node: Node, content_bytes: bytes) -> list[str]:
	"""
	Extract names of functions/methods called within a node's scope.

	Args:
	    node: The tree-sitter node (e.g., function/method body)
	    content_bytes: Source code content as bytes

	Returns:
	    List of called function/method names

	"""

extract_signature

extract_signature(
	node: Node, content_bytes: bytes
) -> str | None

Extract the signature (definition line without body) for a function, class, etc.

Parameters:

Name Type Description Default
node Node

The node to extract the signature from.

required
content_bytes bytes

Source code content as bytes.

required

Returns:

Type Description
str | None

The signature string, or None if not applicable.

Source code in src/codemap/processor/tree_sitter/languages/base.py
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
def extract_signature(self, node: Node, content_bytes: bytes) -> str | None:
	"""
	Extract the signature (definition line without body) for a function, class, etc.

	Args:
	    node: The node to extract the signature from.
	    content_bytes: Source code content as bytes.

	Returns:
	    The signature string, or None if not applicable.

	"""
	# Default implementation: return the first line of the node's text
	try:
		first_line = content_bytes[node.start_byte : node.end_byte].split(b"\n", 1)[0]
		return first_line.decode("utf-8", errors="ignore").strip()
	except (IndexError, UnicodeDecodeError):
		# Catch specific errors related to slicing and decoding
		return None

get_enclosing_node_of_type

get_enclosing_node_of_type(
	node: Node, target_type: EntityType
) -> Node | None

Find the first ancestor node that matches the target entity type.

Parameters:

Name Type Description Default
node Node

The starting node.

required
target_type EntityType

The EntityType to search for in ancestors.

required

Returns:

Type Description
Node | None

The ancestor node if found, otherwise None.

Source code in src/codemap/processor/tree_sitter/languages/base.py
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
def get_enclosing_node_of_type(self, node: Node, target_type: EntityType) -> Node | None:
	"""
	Find the first ancestor node that matches the target entity type.

	Args:
	    node: The starting node.
	    target_type: The EntityType to search for in ancestors.

	Returns:
	    The ancestor node if found, otherwise None.

	"""
	current = node.parent
	while current:
		# We need content_bytes to determine the type accurately, but we don't have it here.
		# This highlights a limitation of doing this purely structurally without context.
		# Subclasses might need a different approach or access to the analyzer/content.
		# For a basic structural check:
		# entity_type = self.get_entity_type(current, current.parent, ???) # Need content_bytes
		# if entity_type == target_type:
		#    return current

		# Simplistic check based on node type name (less reliable)
		if target_type.name.lower() in current.type.lower():  # Very rough check
			return current
		current = current.parent
	return None

PythonConfig dataclass

Bases: LanguageConfig

Configuration for Python language.

Source code in src/codemap/processor/tree_sitter/languages/base.py
331
332
333
334
335
336
337
338
339
340
class PythonConfig(LanguageConfig):
	"""Configuration for Python language."""

	module: ClassVar[list[str]] = ["module"]
	class_: ClassVar[list[str]] = ["class_definition"]
	function: ClassVar[list[str]] = ["function_definition"]
	property_def: ClassVar[list[str]] = ["decorated_definition"]
	struct: ClassVar[list[str]] = []
	docstring: ClassVar[list[str]] = ["string"]
	file_extensions: ClassVar[list[str]] = [".py", ".pyi"]

module class-attribute

module: list[str] = ['module']

class_ class-attribute

class_: list[str] = ['class_definition']

function class-attribute

function: list[str] = ['function_definition']

property_def class-attribute

property_def: list[str] = ['decorated_definition']

struct class-attribute

struct: list[str] = []

docstring class-attribute

docstring: list[str] = ['string']

file_extensions class-attribute

file_extensions: list[str] = ['.py', '.pyi']

JavaScriptConfig dataclass

Bases: LanguageConfig

Configuration for JavaScript language.

Source code in src/codemap/processor/tree_sitter/languages/base.py
343
344
345
346
347
348
349
350
351
352
class JavaScriptConfig(LanguageConfig):
	"""Configuration for JavaScript language."""

	module: ClassVar[list[str]] = ["program"]
	class_: ClassVar[list[str]] = ["class_declaration", "class"]
	function: ClassVar[list[str]] = ["function_declaration", "method_definition", "function"]
	property_def: ClassVar[list[str]] = ["property_definition", "property_identifier"]
	struct: ClassVar[list[str]] = []
	docstring: ClassVar[list[str]] = ["comment"]
	file_extensions: ClassVar[list[str]] = [".js", ".jsx"]

module class-attribute

module: list[str] = ['program']

class_ class-attribute

class_: list[str] = ['class_declaration', 'class']

function class-attribute

function: list[str] = [
	"function_declaration",
	"method_definition",
	"function",
]

property_def class-attribute

property_def: list[str] = [
	"property_definition",
	"property_identifier",
]

struct class-attribute

struct: list[str] = []

docstring class-attribute

docstring: list[str] = ['comment']

file_extensions class-attribute

file_extensions: list[str] = ['.js', '.jsx']

TypeScriptConfig dataclass

Bases: LanguageConfig

Configuration for TypeScript language.

Source code in src/codemap/processor/tree_sitter/languages/base.py
355
356
357
358
359
360
361
362
363
364
class TypeScriptConfig(LanguageConfig):
	"""Configuration for TypeScript language."""

	module: ClassVar[list[str]] = ["program"]
	class_: ClassVar[list[str]] = ["class_declaration", "class"]
	function: ClassVar[list[str]] = ["function_declaration", "method_definition", "function"]
	property_def: ClassVar[list[str]] = ["property_definition", "property_identifier"]
	struct: ClassVar[list[str]] = []
	docstring: ClassVar[list[str]] = ["comment"]
	file_extensions: ClassVar[list[str]] = [".ts", ".tsx"]

module class-attribute

module: list[str] = ['program']

class_ class-attribute

class_: list[str] = ['class_declaration', 'class']

function class-attribute

function: list[str] = [
	"function_declaration",
	"method_definition",
	"function",
]

property_def class-attribute

property_def: list[str] = [
	"property_definition",
	"property_identifier",
]

struct class-attribute

struct: list[str] = []

docstring class-attribute

docstring: list[str] = ['comment']

file_extensions class-attribute

file_extensions: list[str] = ['.ts', '.tsx']

RustConfig dataclass

Bases: LanguageConfig

Configuration for Rust language.

Source code in src/codemap/processor/tree_sitter/languages/base.py
367
368
369
370
371
372
373
374
375
376
class RustConfig(LanguageConfig):
	"""Configuration for Rust language."""

	module: ClassVar[list[str]] = ["source_file"]
	class_: ClassVar[list[str]] = ["impl_item"]
	function: ClassVar[list[str]] = ["function_item"]
	property_def: ClassVar[list[str]] = []
	struct: ClassVar[list[str]] = ["struct_item"]
	docstring: ClassVar[list[str]] = ["line_comment", "block_comment"]
	file_extensions: ClassVar[list[str]] = [".rs"]

module class-attribute

module: list[str] = ['source_file']

class_ class-attribute

class_: list[str] = ['impl_item']

function class-attribute

function: list[str] = ['function_item']

property_def class-attribute

property_def: list[str] = []

struct class-attribute

struct: list[str] = ['struct_item']

docstring class-attribute

docstring: list[str] = ['line_comment', 'block_comment']

file_extensions class-attribute

file_extensions: list[str] = ['.rs']

GoConfig dataclass

Bases: LanguageConfig

Configuration for Go language.

Source code in src/codemap/processor/tree_sitter/languages/base.py
379
380
381
382
383
384
385
386
387
388
class GoConfig(LanguageConfig):
	"""Configuration for Go language."""

	module: ClassVar[list[str]] = ["source_file"]
	class_: ClassVar[list[str]] = ["type_declaration"]
	function: ClassVar[list[str]] = ["function_declaration"]
	property_def: ClassVar[list[str]] = []
	struct: ClassVar[list[str]] = ["struct_type"]
	docstring: ClassVar[list[str]] = ["comment"]
	file_extensions: ClassVar[list[str]] = [".go"]

module class-attribute

module: list[str] = ['source_file']

class_ class-attribute

class_: list[str] = ['type_declaration']

function class-attribute

function: list[str] = ['function_declaration']

property_def class-attribute

property_def: list[str] = []

struct class-attribute

struct: list[str] = ['struct_type']

docstring class-attribute

docstring: list[str] = ['comment']

file_extensions class-attribute

file_extensions: list[str] = ['.go']