Support extra extensions with optional language mapping#32
Merged
georgeh0 merged 2 commits intococoindex-io:mainfrom Mar 5, 2026
Merged
Support extra extensions with optional language mapping#32georgeh0 merged 2 commits intococoindex-io:mainfrom
georgeh0 merged 2 commits intococoindex-io:mainfrom
Conversation
…S env var Users can now specify additional file extensions to index without editing source code, e.g. COCOINDEX_CODE_EXTRA_EXTENSIONS="inc,tpl"
Allow `ext:lang` format (e.g. "inc:php,yaml,tpl:html") to override language detection for extra extensions, enabling proper AST-based chunking for unrecognized extensions.
Member
|
super cool! thanks for contribution!! @georgeh0 can help take a look! |
georgeh0
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Some legacy PHP projects use
.incas a file extension, but it is currently not indexed and therefore excluded from code search.Changes
Users can now specify additional file extensions to index via the
COCOINDEX_CODE_EXTRA_EXTENSIONSenvironment variable.COCOINDEX_CODE_EXTRA_EXTENSIONS="inc,tpl"Language detection is handled by the
detect_code_languagefunction in cocoindex, but some extensions like.incare not tied to a specific language. To handle this, users can now specify the language explicitly using theext:langformat to override detection.COCOINDEX_CODE_EXTRA_EXTENSIONS="inc:php,yaml,tpl:html"When no language is specified, it falls back to
detect_code_languageas before.Note
Language mapping is currently handled on the caller side. If there is a better place for this (e.g. extending
detect_code_language), I'm happy to adjust the approach.Tests
All 20 tests pass