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

Schema autocompletion intellisense don't match custom datasource name

Open allanmarianodev opened this issue 3 years ago • 1 comments
trafficstars

Bug description

When defining a custom name for the datasource object, the autocompletion feature inserts the default db name even though vscode intellisense popup shows the custom name defined in the schema.

How to reproduce

  1. Create a datasource with custom name (e.g. datasource postgresql { ... }
  2. Define a native database type mapping using autocompletion intellisense (e.g. type @post and activate autocompletion).

Expected behavior

The custom datasource name (e.g. @postgresql) should be inserted.

Prisma information

generator client {
  provider = "prisma-client-js"
}

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

model Product {
  productId String   @id @default(dbgenerated("gen_random_uuid()")) @map("product_id") @postgres.Uuid
  name      String   @unique
  price     Decimal  @postgresql.Money
  createdAt DateTime @default(now()) @map("created_at")
  updatedAt DateTime @updatedAt @map("updated_at")

  @@map("products")
}

Environment & setup

  • OS: Pop_OS! 22.04
  • Database: PostgreSQL 14-alpine docker image
  • Node.js version: 16.16.0

Prisma Version

prisma                  : 4.2.1
@prisma/client          : 4.2.1
Current platform        : debian-openssl-3.0.x
Query Engine (Node-API) : libquery-engine 2920a97877e12e055c1333079b8d19cee7f33826 (at node_modules/@prisma/engines/libquery_engine-debian-openssl-3.0.x.so.node)
Migration Engine        : migration-engine-cli 2920a97877e12e055c1333079b8d19cee7f33826 (at node_modules/@prisma/engines/migration-engine-debian-openssl-3.0.x)
Introspection Engine    : introspection-core 2920a97877e12e055c1333079b8d19cee7f33826 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-3.0.x)
Format Binary           : prisma-fmt 2920a97877e12e055c1333079b8d19cee7f33826 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-3.0.x)
Default Engines Hash    : 2920a97877e12e055c1333079b8d19cee7f33826
Studio                  : 0.469.0

allanmarianodev avatar Aug 10 '22 17:08 allanmarianodev

I can confirm this. What a stupid bug - we will fix this.

janpio avatar Aug 10 '22 19:08 janpio