feat(python): expose language extensions for paths - #17
Closed
DavidBakerEffendi wants to merge 1 commit into
Closed
Conversation
…s_for_paths Callers building a scoped SearchToolsClient session (sources=[...]) need to know which languages a diff owns so the workspace can be scoped without losing find-usages completeness. Expose the Language source-extension registry as a pure Python function that opens no workspace. extensions_for_paths resolves each path through Language::languages_for_source_extension, including reference-only siblings such as TS/JS .vue/.svelte and C# .razor/.cshtml. A .vue file expands both JavaScript and TypeScript. Wrap it in bifrost_searchtools.client.extensions_for_paths and export it like tool_descriptors. This adapts the cherry-pick of sontek/bifrost@89a3cc41e0 to current master: from_extension remains analyzable-only, while the source-extension classifier recognizes reference-only files. Preserve the existing code-query inventory API from master.
Contributor
Author
|
Retargeted to the private repo: BrokkAi/bifrost-dev#2973. This repo's master is projection-only. |
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.
Description
Adds a workspace-free Python API that expands changed paths to the complete Bifrost source-extension set for their language(s). This lets callers classify a diff before constructing or indexing a scoped session.
Fixes #14
Credit and reference implementation: @sontek, sontek/bifrost#4.
Key Changes
Language::languages_for_source_extensionas the structured classifier for both analyzable and reference-only source extensions.Language::from_extensionanalyzable-only;.vueand.razorare source files but are not analyzer-entry extensions.extensions_for_pathsto the PyO3 native module, including all extensions for every matching language. A.vuepath expands JavaScript and TypeScript together.bifrost_searchtools.client.extensions_for_paths(paths, library_path=None)and export it, matchingtool_descriptors().Adapted from commit
89a3cc41e0onsontek/bifrost:pr/issue-14-language-extensions. Resolved current-master conflicts aroundcode_query_variant_inventoryand corrected reference-only extension classification.Touch Points
crates/bifrost-core/src/analyzer/model.rssrc/python_module.rsbifrost_searchtools/client.pybifrost_searchtools/__init__.py