feat: add ReScript language support#58
Conversation
Add ReScript (https://rescript-lang.org/) as a supported language with tree-sitter parsing for .res and .resi files. The tree-sitter-rescript.wasm grammar (908KB) was built from https://github.com/rescript-lang/tree-sitter-rescript via Docker + emscripten. AST node mappings cover let_declaration, module_declaration, type_declaration, call_expression, pipe_expression, open_statement, and include_statement. Fix symbol disambiguation in MCP tools: add file parameter to codegraph_node, codegraph_callers, codegraph_callees, and codegraph_impact so that ambiguous symbol names can be resolved by file path. When file is provided but no match is found, return an error instead of silently falling back to a different symbol. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…E.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolves merge conflicts with upstream's refactored extraction architecture: - Language extraction split into per-file modules in src/extraction/languages/ - ReScript extractor moved to src/extraction/languages/rescript.ts using the visitNode hook with ExtractorContext API - MCP tools updated to use upstream's findAllSymbols approach (file param for disambiguation superseded by aggregation across all matching symbols) - CLAUDE.md and README.md updated with both Svelte and ReScript Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The file parameter was added to codegraph_callers, codegraph_callees, codegraph_impact, and codegraph_node schemas but the handlers never used it. Conflict resolution replaced the implementation with upstream's findAllSymbols aggregation approach. Remove the dead schema entries to keep the diff purely ReScript-related. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…oading Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…architecture Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hi! Sorry to drop in cold — I've been working through the open PR backlog and noticed your PR is waiting on the same architectural conflict as a bunch of other language PRs. I've opened a refactor PR (#116) that turns "adding a language" from a 6-file mutation into a 1-file addition. Once that lands, this PR rebases cleanly. Sharing the rebase template inline so you don't have to read the maintainer guide to do it. After #116 merges, the rebase is mechanicalStep 1. Discard your changes to the monolithic files (#116 makes them auto-derived from the registry): git checkout main -- \
src/types.ts \
src/extraction/grammars.ts \
src/extraction/languages/index.ts \
CLAUDE.mdStep 2. Move your extractor's registration into one file, import { yourExtractor } from './your-extractor-config';
import type { LanguageDef } from './types';
export const YOUR_DEF: LanguageDef = {
name: 'yourlang',
displayName: 'Your Language',
extensions: ['.ext'],
includeGlobs: ['**/*.ext'],
// For a tree-sitter grammar:
grammar: { wasmFile: 'tree-sitter-yourlang.wasm', vendored: true, extractor: yourExtractor },
// OR for a custom regex/template extractor (Liquid, HCL pattern):
// customExtractor: (filePath, source) => new YourExtractor(filePath, source).extract(),
};Step 3. Add 2 lines to import { YOUR_DEF } from './yourlang'; // alphabetical
// ...
const ALL_DEFS: readonly LanguageDef[] = [
// ... alphabetical
YOUR_DEF,
// ...
];Step 4. Add Step 5. Your test additions in That's it. If your existing Three of my own language PRs (#92, #94, #95) are already pre-rebased to this pattern as references if you want to see what a finished rebase looks like. Happy to help with the rebase if you'd like — just let me know. |
Add ReScript (https://rescript-lang.org/) as a supported language with tree-sitter parsing for .res and .resi files.
The tree-sitter-rescript.wasm grammar (908KB) was built from https://github.com/rescript-lang/tree-sitter-rescript via Docker + emscripten. AST node mappings cover let_declaration, module_declaration, type_declaration, call_expression, pipe_expression, open_statement, and include_statement.
Fix symbol disambiguation in MCP tools: add file parameter to codegraph_node, codegraph_callers, codegraph_callees, and codegraph_impact so that ambiguous symbol names can be resolved by file path. When file is provided but no match is found, return an error instead of silently falling back to a different symbol.