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 5 months ago • 0 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"]
}
// schema.prisma
model Test {
  id Int @id
@@schema("schemaA")
}

// schemaB.prisma
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