Skip to content

support Dart#24

Open
MinhDuy-creator wants to merge 1 commit intoFreePeak:mainfrom
MinhDuy-creator:feature/support-dart
Open

support Dart#24
MinhDuy-creator wants to merge 1 commit intoFreePeak:mainfrom
MinhDuy-creator:feature/support-dart

Conversation

@MinhDuy-creator
Copy link
Copy Markdown

Add Dart/Flutter support to LeanKG indexer via tree-sitter-dart.

Cargo.toml - add tree-sitter-dart dependency
src/indexer/mod.rs - add .dart to extension list, new parser slot, filter node_modules
src/indexer/extractor.rs - add Dart test file detection, filter Flutter built-ins (setState, build, context...), support additional node types (mixin, extension, type_alias...), 11 unit tests

Copy link
Copy Markdown
Member

@linhdmn linhdmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MR Overview

  • Title: support Dart
  • Author: MinhDuy-creator
  • Branch: feature/support-dart → main

1. Logic Review

Issues Found

  • File: src/indexer/extractor.rs:89

    • Severity: warning
    • Issue: tree-sitter-dart crate version is "0.1.0" which may not be stable. Verify the crate is actively maintained.
    • Suggestion: Consider pinning to a specific version or verifying compatibility with tree-sitter parser interface.
  • File: src/indexer/extractor.rs:41

    • Severity: info
    • Issue: Dart test file pattern _widget_test.dart - only underscores in filename are considered. Flutter also uses test/widget_test.dart convention.
    • Suggestion: Already handled by path.components().any(|c| c.as_os_str() == "test") check.
  • File: src/indexer/extractor.rs:99

    • Severity: info
    • Issue: is_noise_call for Dart includes many keywords (static, final, const, var, extends, implements). These are language keywords, not function calls. However, including them prevents false positives in call relationships.
    • Suggestion: This is acceptable behavior - keywords used as identifiers in some contexts.

2. Scope Validation

In Scope: Dart language support for indexer
Files: src/indexer/mod.rs, src/indexer/extractor.rs, Cargo.toml, Cargo.lock

3. Impact Analysis

  • Changed Functions: is_test_file, get_tested_file_path, is_noise_call, extract_* methods
  • Affected Modules: indexer (Dart parsing)
  • Risk Level: low (additive language support, no breaking changes)
  • New Dependency: tree-sitter-dart

4. Deep Scan Findings

✅ Test coverage: 11 new tests for Dart extraction
✅ Node types supported: class, mixin, extension, type_alias, function_signature, constructor_signature

5. Suggested Description Update

## Scope of Changes

### Files Changed
- `Cargo.toml` - Added tree-sitter-dart dependency
- `src/indexer/mod.rs` - Added .dart to extension list, parser slot 6
- `src/indexer/extractor.rs` - Dart test detection, noise call filtering, node type support

### Impact Analysis
- **Affected Modules:** indexer
- **Risk Level:** low
- **New Tests:** 11 (class, mixin, extension, function, method, import, stateful widget)

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