language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

Go To Definition doesn't work if the model belongs to a different schema (Using MultiSchema)

Open Amueller36 opened this issue 8 months ago • 1 comments

Bug description

In Visual Studio Code, the "Go to Definition" feature does not work when referencing a model defined in a different schema file using Prisma's @@schema annotation in a multi-schema setup.

How to reproduce

  1. Create a Prisma project with multiple schema files using the @@schema annotation.
  2. In Schema A, define a model named Test.
  3. In Schema B, define another model named Test_2 and reference the Test model (e.g., as a relation field).
  4. Attempt to use "Go to Definition" on the reference to Test within Test_2.

Expected behavior

It should navigate me to the Test Model Definition.

Prisma information


generator client {
  provider        = "prisma-client-js"
  output          = "../src/generated/prisma"
  previewFeatures = ["multiSchema"]
}

datasource db {
  provider   = "postgresql"
  url        = env("DATABASE_URL")
  schemas    = ["schemaA", "schemaB"]
}

model Test {
  id Int @id
@@schema("schemaA")
}


model Test_2 {
  id Int @id
  test Test @relation(fields: [testId], references: [id])
  testId Int
@@schema("schemaB")
}

Environment & setup

  • OS: Windows
  • Editor: VS Code
  • Editor version: 1.101.2
  • Extension version: v.6.10.1

Amueller36 avatar Jun 26 '25 15:06 Amueller36

def run_titan_advisors(): logging.info("הפעלת יועצי TITAN עם כלי חיזוי - מחזור חדש") total_revenue = 0.0

# המרת נתוני היועצים לפורמט אחיד (AdvisorState)
advisors: List[AdvisorState] = []
for aid, raw in advisors_data.items():
    advisors.append(
        AdvisorState(
            id=aid,
            name=raw.get("name", f"Advisor-{aid}"),
            rank=raw.get("rank", "bronze"),
            stars=raw.get("stars", 0),
            kpi_revenue=raw.get("kpi_revenue", 0.0),
            questions=raw.get("questions", 0),
            global_questions=raw.get("global_questions", 0),
            travel_tasks=raw.get("travel_tasks", 0),
            campaigns_google_ads=raw.get("campaigns_google_ads", 0),
            meta=copy.deepcopy(raw.get("meta", {})),
        )
    )

# אתחול שירותים חיצוניים (במצב DRY_RUN לא מתחברים באמת)
gmail_service = None
adwords_client = None

# לולאה על כל יועץ במערכת
for advisor in advisors:
    tasks = assign_tasks(advisor)
    revenue = execute_tasks(advisor, tasks)

    # עדכון מדדי הביצועים של היועץ (KPIs)
    advisor.kpi_revenue += revenue
    advisor.questions += len(tasks)
    advisor.global_questions += len(tasks) // 2
    advisor.travel_tasks += sum(1 for t in tasks if t["type"] == "travel")
    advisor.campaigns_google_ads += 1 if random.random() < 0.2 else 0

    # קידום דרגה אם יש צורך
    promote_rank_if_needed(advisor)

    # שיגור נתונים לכלי חיזוי אנליטי
    forecast_data = {
        "revenue": revenue,
        "tasks": len(tasks),
        "probability_weight": RANK_LEVELS[advisor.rank]["probability_weight"],
    }
    manage_forecast_tool("h2o_ai", None, forecast_data)

    # עדכון ההכנסה הכוללת
    total_revenue += revenue

# ניהול קמפיינים, עדכון טבלה ושליחת התראה
manage_google_ads(adwords_client, "INSERT_CAMPAIGN_ID_HERE", 1000.0, total_revenue)
update_live_table(advisors)
alert_message = (
    f"מחזור TITAN הושלם: הכנסות ${total_revenue:.2f}, "
    f"יועצים: {len(advisors)}, "
    f"שאלות גלובליות: {sum(a.global_questions for a in advisors)}"
)
send_gmail_alert(alert_message, gmail_service)

# החזרת התוצאות בפורמט נוח
result = {
    a.id: {
        "name": a.name,
        "rank": a.rank,
        "stars": a.stars,
        "kpi_revenue": a.kpi_revenue,
        "questions": a.questions,
        "global_questions": a.global_questions,
        "travel_tasks": a.travel_tasks,
        "campaigns_google_ads": a.campaigns_google_ads,
        "meta": a.meta,
    }
    for a in advisors
}
return result, total_revenue

Sharonmiara avatar Aug 13 '25 22:08 Sharonmiara