Skip to content

Autocomplete for relations doesn't work properly for multifile schema #1934

@WhyAsh5114

Description

@WhyAsh5114

Bug description

This bug is particularly related with the VSCode extension for Prisma. When trying to autocomplete relations across different files, we need to trigger it once from both sides of the relation.

When its a single file, it works as expected, autocompleting both.

Severity

🔹 Minor: Unexpected behavior, but does not block development

Reproduction

prisma.autocomplete.mp4

Expected vs. Actual Behavior

Should autocomplete both sides directly.
Only completes the current file's relation.

Frequency

Consistently reproducible

Does this occur in development or production?

Only in development (e.g., CLI tools, migrations, Prisma Studio)

Is this a regression?

I'm not sure. But probably not as far as I know.

Workaround

Just trigger autocomplete in both files sequentially.

Prisma Schema & Queries

schema.prisma

generator client {
  provider = "prisma-client-js"
  output   = "../generated/prisma"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model Parent {
  id    Int     @id @default(autoincrement())
  name  String
  Child Child[]
}

other.prisma

model Child {
  id   Int    @id @default(autoincrement())
  name String

  parent   Parent @relation(fields: [parentId], references: [id])
  parentId Int
}

Prisma Config

Logs & Debug Info

Environment & Setup

Not needed, can be reproduced without any setup.

Prisma Version

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
prisma                  : 6.16.3
@prisma/client          : Not found
Computed binaryTarget   : debian-openssl-3.0.x
Operating System        : linux
Architecture            : x64
Node.js                 : v22.20.0
TypeScript              : unknown
Query Engine (Node-API) : libquery-engine bb420e667c1820a8c05a38023385f6cc7ef8e83a (at node_modules/.pnpm/@prisma+engines@6.16.3/node_modules/@prisma/engines/libquery_engine-debian-openssl-3.0.x.so.node)
PSL                     : @prisma/prisma-schema-wasm 6.16.1-1.bb420e667c1820a8c05a38023385f6cc7ef8e83a
Schema Engine           : schema-engine-cli bb420e667c1820a8c05a38023385f6cc7ef8e83a (at node_modules/.pnpm/@prisma+engines@6.16.3/node_modules/@prisma/engines/schema-engine-debian-openssl-3.0.x)
Default Engines Hash    : bb420e667c1820a8c05a38023385f6cc7ef8e83a
Studio                  : 0.511.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions