Svelte: a call in markup (event handler, `{expression}`) produces no CALLS edge — only `<script>` calls are linked

Offen
#3,125 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
56/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
c, typescript

Rechercherichtung

Start by tracing how Svelte files are parsed and how CALLS edges are extracted for <script> content. Use the supplied three-file reproduction, especially the markup event handler and {exportRows(rows)} expression, then compare its graph with the InScript.svelte result. Done means markup calls produce the expected caller edge in trace_path and query_graph.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug parsing/quality ux/behavior
Version

codebase-memory-mcp 0.12.1

Platform

Linux (x64)

Install channel

GitHub release archive / install.sh

Binary variant

ui

What happened, and what did you expect?

A function that a Svelte component calls only in its markup gets no CALLS edge from that component. Calls inside <script> are linked (fixed with #1807). So trace_path and "who calls X" miss every component that calls a function from an event handler or a template expression, and the function can look unused.

Expected: the component is a caller, as it is for a call in <script>.

Reproduction
  1. Code, a dummy project of three files:
// src/lib/export.ts
export function exportRows(rows: string[]): string {
  return rows.join("\n");
}
<!-- src/lib/InScript.svelte -->
<script lang="ts">
  import { exportRows } from "./export";

  let rows: string[] = [];

  function download() {
    exportRows(rows);
  }
</script>

<button onclick={download}>Export</button>
<!-- src/lib/InMarkup.svelte -->
<script lang="ts">
  import { exportRows } from "./export";

  let rows: string[] = [];
</script>

<button onclick={() => exportRows(rows)}>Export</button>
<p>{exportRows(rows)}</p>

package.json: {"name": "repro", "private": true, "type": "module", "devDependencies": {"svelte": "^5.0.0"}}

  1. MCP tool calls:
index_repository {"repo_path": "/tmp/repro-svelte", "mode": "full"}
trace_path {"project": "tmp-repro-svelte", "function_name": "exportRows", "direction": "inbound", "depth": 1}
query_graph {"project": "tmp-repro-svelte", "format": "json",
  "query": "MATCH (a)-[r]->(b) WHERE b.name = 'exportRows' RETURN a.name, a.label, a.file_path, type(r)"}
  1. Result: trace_path reports callers_total: 1, the function download in src/lib/InScript.svelte. query_graph returns two rows: that CALLS edge and the DEFINES edge of export.ts. Nothing points from src/lib/InMarkup.svelte to exportRows.

Expected: a caller in src/lib/InMarkup.svelte as well. The file holds two markup forms, an arrow function in an event attribute and a {…} expression. I did not test them one by one; together they produce no edge.

The index reported no gaps: not_indexed_files_count 0, parse_partial_count 0.

Project scale (if relevant)

14 nodes / 16 edges / 4 files

Confirmations
  • I searched existing issues and this is not a duplicate.
  • My reproduction uses shareable code (a dummy snippet or a public OSS repository), not proprietary code.
Vorherrschende Sprache
C
Sterne
45.8k
Forks
3.8k
Ø Merge
2 T. 18 Std.
Gemergte PRs (30 T.)
108

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus DeusData/codebase-memory-mcp

Alle Issues in DeusData/codebase-memory-mcp

Ähnliche Issues

Weitere Issues zu C

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.