Skip to content

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

@Amueller36

Description

@Amueller36

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions