Skip to content

If a comment is the last line in a model, prisma format will move it out of the model #2441

@sdnts

Description

@sdnts

Bug description

How to reproduce

  1. Save this schema:
generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = "postgresql://siddhant@localhost:5432/throwaway"
}

model User {
  id     Int    @id
  name   String
  // Comment
  email  String @unique
  // Comment 2
}
  1. When you run prisma format / save in the VSCode extension, the schema becomes:
generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = "postgresql://siddhant@localhost:5432/throwaway"
}

// Comment 2
model User {
  id     Int    @id
  name   String
  // Comment
  email  String @unique
}

Expected behavior

The schema should be:

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

datasource db {
  provider = "postgresql"
  url      = "postgresql://siddhant@localhost:5432/throwaway"
}

model User {
  id     Int    @id
  name   String
  // Comment
  email  String @unique
  // Comment 2
}

Environment & setup

  • OS: macOS
  • Database: Postgres
  • Prisma version:
@prisma/cli          : 2.0.0-beta.5
Current platform     : darwin
Query Engine         : query-engine 0c2ec197653b278b2978845ef958db88824cd82e
Migration Engine     : migration-engine-cli 0c2ec197653b278b2978845ef958db88824cd82e
Introspection Engine : introspection-core 0c2ec197653b278b2978845ef958db88824cd82e
Format Binary        : prisma-fmt 0c2ec197653b278b2978845ef958db88824cd82e
  • Node.js version: v12.16.3

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions