Documentation
¶
Overview ¶
Package langs provides chunker.LanguageConfig definitions for the 15 languages built into codamigo. Each language is implemented in its own file (go.go, python.go, …) and lazily initialised via sync.OnceValue so the CGo grammars are loaded only once per process.
Import this package only from cmd/codamigo. All other packages receive language support through a *chunker.Chunker injected at construction time, keeping CGo out of the library layer.
Package langs provides tree-sitter language configurations for the chunker.
Markdown note: github.com/tree-sitter-grammars/tree-sitter-markdown@v0.5.3 does not publish a bindings/go package, so the C sources are vendored under internal/markdown_cgo and compiled via CGo. When a proper Go binding becomes available, replace this with the standard sitter.NewLanguage(markdown.Language()) pattern used by all other languages.
Vendored grammar note: github.com/tree-sitter-grammars/tree-sitter-vue does not publish a bindings/go package, so the C sources are vendored under internal/vue_cgo and compiled via CGo at commit ce8011a414fdf8091f4e4071752efc376f4afb08. When a proper Go binding becomes available, replace this with the standard sitter.NewLanguage(vue.Language()) pattern.
Index ¶
- func AllLanguages() []chunker.LanguageConfig
- func BashLanguage() chunker.LanguageConfig
- func CLanguage() chunker.LanguageConfig
- func CSSLanguage() chunker.LanguageConfig
- func CppLanguage() chunker.LanguageConfig
- func GoLanguage() chunker.LanguageConfig
- func HTMLLanguage() chunker.LanguageConfig
- func JSONLanguage() chunker.LanguageConfig
- func JavaScriptLanguage() chunker.LanguageConfig
- func MarkdownLanguage() chunker.LanguageConfig
- func PythonLanguage() chunker.LanguageConfig
- func RubyLanguage() chunker.LanguageConfig
- func TSXLanguage() chunker.LanguageConfig
- func TypeScriptLanguage() chunker.LanguageConfig
- func VueLanguage() chunker.LanguageConfig
- func YAMLLanguage() chunker.LanguageConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllLanguages ¶
func AllLanguages() []chunker.LanguageConfig
AllLanguages returns LanguageConfigs for all 15 built-in languages. Pass this to chunker.NewChunker for full language coverage. To add a language not listed here, append your LanguageConfig to the returned slice.
func BashLanguage ¶
func BashLanguage() chunker.LanguageConfig
BashLanguage returns the LanguageConfig for Bash scripts (.sh, .bash).
func CLanguage ¶
func CLanguage() chunker.LanguageConfig
CLanguage returns the LanguageConfig for C source files (.c, .h). Symbol names are not extracted (NameField is empty) because C function names are nested inside declarator chains rather than at a direct "name" field.
func CSSLanguage ¶
func CSSLanguage() chunker.LanguageConfig
CSSLanguage returns the LanguageConfig for CSS stylesheets (.css).
func CppLanguage ¶
func CppLanguage() chunker.LanguageConfig
CppLanguage returns the LanguageConfig for C++ source files (.cpp, .cc, .cxx, .hpp).
func GoLanguage ¶
func GoLanguage() chunker.LanguageConfig
GoLanguage returns the LanguageConfig for Go source files.
func HTMLLanguage ¶
func HTMLLanguage() chunker.LanguageConfig
HTMLLanguage returns the LanguageConfig for HTML files (.html, .htm).
func JSONLanguage ¶
func JSONLanguage() chunker.LanguageConfig
JSONLanguage returns the LanguageConfig for JSON files (.json).
func JavaScriptLanguage ¶
func JavaScriptLanguage() chunker.LanguageConfig
JavaScriptLanguage returns the LanguageConfig for JavaScript files (.js, .mjs, .cjs, .jsx).
func MarkdownLanguage ¶
func MarkdownLanguage() chunker.LanguageConfig
MarkdownLanguage returns the LanguageConfig for Markdown files.
func PythonLanguage ¶
func PythonLanguage() chunker.LanguageConfig
PythonLanguage returns the LanguageConfig for Python source files (.py, .pyw).
func RubyLanguage ¶
func RubyLanguage() chunker.LanguageConfig
RubyLanguage returns the LanguageConfig for Ruby source files (.rb).
func TSXLanguage ¶
func TSXLanguage() chunker.LanguageConfig
TSXLanguage returns the LanguageConfig for TSX files (.tsx).
func TypeScriptLanguage ¶
func TypeScriptLanguage() chunker.LanguageConfig
TypeScriptLanguage returns the LanguageConfig for TypeScript files (.ts, .mts).
func VueLanguage ¶
func VueLanguage() chunker.LanguageConfig
VueLanguage returns the LanguageConfig for Vue single-file components (.vue). Script blocks are re-parsed with the TypeScript or JavaScript grammar based on the lang attribute (e.g. <script lang="ts">), producing function-level chunks suitable for vector embedding RAG. <script setup> blocks are handled identically to plain <script> blocks — both produce function/declaration-level chunks.
func YAMLLanguage ¶
func YAMLLanguage() chunker.LanguageConfig
YAMLLanguage returns the LanguageConfig for YAML files (.yaml, .yml).
Types ¶
This section is empty.