aurora icon indicating copy to clipboard operation
aurora copied to clipboard

Feature Request: Integration with the prisma VSC extension + Aurora VSC extension for auto completing relations.

Open YassinEldeeb opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe.

  1. It's very annoying to duplicate a target relation model in the file when we need to use it in a model field.
// Author.prisma
model Author {
    id        Int @id @default(autoincrement())
    books     Book[]
}

model Book {
    id Int @id
    authorId Int
    author Author @relation(fields: [authorId], references: [id])
}
  1. There's no auto-completion in the relation models that are defined in other files.

Describe the solution you'd like

  1. Make a VSC extension for Aurora and Its job will be as the following:

    • Read the aurora.config.json file to get the files array so that we can add onChange watchers on the matching files using VSC SDK.
    • Add provideCompletionItems to the IntelliSense with the models specified in the files that we're watching to provide auto completion when writing relations in model fields.
    • Add an onChange watcher for the aurora.config.json to reset the files' watchers if it changes.
  2. Add an Integration for Aurora with Prisma's VSC extension as the following:

    • Ignore throwing errors on missing models in relationships when an aurora.config.json file is found in the project so that handling missing models will be Aurora's responsibility as it has all of the information about all of the models that are defined in the project.
  3. Add an optional config object to getDMMF so that we can optionally apply a feature to use Aurora which will skip throwing errors related to missing models in relations.

Additional context

I'm willing to contribute to this repo and the Prisma extension repo to implement this feature, just let me know WDYT?

YassinEldeeb avatar Apr 09 '22 00:04 YassinEldeeb

The problem/solution was inspired by the talk that I've just watched an hour ago by the Prisma advocacy team in What's new in Prisma (v3.12.0) when you were talking about potential solutions to fix this problem.

YassinEldeeb avatar Apr 09 '22 00:04 YassinEldeeb