Dart: method node line range covers only the signature, so get_code_snippet returns no body
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
Research direction
Start by tracing how Dart method nodes get their line ranges and how get_code_snippet uses those ranges; the issue identifies the affected cases: block bodies, multiline signatures, and arrow bodies. Reproduce with the supplied lib/repro.dart example and compare the outline and snippet ranges with the expected lines. Done means method snippets include their full bodies, or clearly indicate when a body was not captured.
Written by the indexing model from the issue text.
Description
Version: 0.12.1 (Windows x64)
In Dart, a Method node's line range ends where the signature ends, not where the body ends. get_code_snippet therefore returns the declaration only — the body is absent from the graph — while source_mode: full claims the source was returned in full. There is no truncation marker, so the answer looks complete.
Class ranges are correct, and CALLS edges are built (calls inside those bodies are extracted), so only the body boundaries are missing.
Repro
pubspec.yaml:
name: cbm_repro_dart
publish_to: 'none'
version: 0.0.1
environment:
sdk: ^3.5.0
lib/repro.dart:
1 typedef Handler = void Function(String message);
2
3 abstract class Base {
4 void ping();
5 }
6
7 class BlockBody extends Base {
8 @override
9 void ping() {
10 final a = 1;
11 final b = a + 1;
12 print(b);
13 }
14
15 int wide(
16 int first,
17 int second, {
18 int third = 0,
19 }) {
20 final sum = first + second + third;
21 return sum;
22 }
23 }
24
25 class ArrowBody extends Base {
26 @override
27 void ping() => print('arrow');
28
29 int twice(int x) => x * 2;
30 }
Then:
index_repository(repo_path: "<dir>", name: "cbm-repro-dart", mode: "full")
get_file_outline(project_name: "cbm-repro-dart", file_path: "lib/repro.dart")
Actual
Base Class 3-5 <- correct
BlockBody Class 7-23 <- correct
ping Method 9-9 <- body is 9-13
wide Method 15-19 <- 19 is the `}) {` line; body runs to 22
ArrowBody Class 25-30 <- correct
ping Method 27-27
twice Method 29-29
get_code_snippet(qualified_name: "cbm-repro-dart.lib.repro.BlockBody.ping"):
start_line: 9
end_line: 9
source_mode: full
source: |
void ping() {
Expected
BlockBody.ping → 9-13, BlockBody.wide → 15-22, and get_code_snippet returning the whole method including its body (or, failing that, a flag saying the body was not captured, so a client can tell this apart from a one-line method).
Why it matters
On a real Flutter project (146 .dart files, 2137 nodes / 9091 edges) 6 of 19 nodes in one file have start_line == end_line, and ApiClient._send comes back as 208-215 when its body ends at 264. That makes get_code_snippet unusable for reading Dart logic: every inspection needs a separate file read, so the graph saves navigation only. Arrow-bodied members — very common in Flutter build methods — degenerate to a single line.
- Dominant language
- C
- Stars
- 45.8k
- Forks
- 3.8k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 108
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DeusData/codebase-memory-mcp
-
bug ux/behavior
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
DeusData/codebase-memory-mcp#3191 ·
Maintainers usually reply within 1 day
-
documentation enhancement parsing/quality ux/behavior
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
DeusData/codebase-memory-mcp#3131 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
hook-augment: the five-row cap keeps the first five search_graph rows, so variables and modules displace function definitions (v0.12.1)Possibly taken A pull request linked to this issue is open or already merged. Openbug editor/integration parsing/quality ux/behavior
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
DeusData/codebase-memory-mcp#3062 · 2 comments ·
Maintainers usually reply within 1 day
-
bug documentation editor/integration parsing/quality
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
DeusData/codebase-memory-mcp#3050 · 1 comment ·
Maintainers usually reply within 1 day
-
editor/integration parsing/quality
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DeusData/codebase-memory-mcp#2286 ·
Maintainers usually reply within 1 day
All issues in DeusData/codebase-memory-mcp
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA/open-gpu-kernel-modules#1635 ·
Maintainers usually reply within 1 day
-
iOS: the "Edit controls" button never hides, even with a controller connected, and covers the gameOpengame: 010065A014024000 ios
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
seedds/nxnative#3714 · 1 comment ·
Maintainers usually reply within 2 days