Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add "languages" configuration option #3231

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dkhokhlov
Copy link

@dkhokhlov dkhokhlov commented Feb 12, 2025

Allows overriding grep_ast's file extension to language mapping through aider config. This enables proper language detection for files that may conflict with default mappings.
Key changes:

  • add languages section to config schema
  • add command line arg --languages to specify mappings
  • override grep_ast's PARSERS dict with user-defined mappings
  • support both Python dict and JSON formats via ast.literal_eval
  • update documentation

Example usage:

# In .aider.conf.yml
languages:
  m: matlab    # treat .m as MATLAB instead of Objective-C
  r: R              # specify R for .r files

Or via command line:

aider --languages "{'m':'matlab', 'r':'R'}"

This enables proper language support for files that may conflict with grep_ast's default mappings, like .m files which default to Objective-C vs Matlab. The mapping can be used with any language supported by py-tree-sitter-languages package, including those added in future versions.

Testing:

  • tested with new py-tree-sitter-languages that includes Matlab support using wheels from this GH build.

@CLAassistant
Copy link

CLAassistant commented Feb 12, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants