vim-prisma icon indicating copy to clipboard operation
vim-prisma copied to clipboard

E363: pattern uses more memory than 'maxmempattern'

Open isaacs opened this issue 3 years ago • 2 comments

This prisma file seems to break the syntax highlighting, not sure why.

Says: E363: pattern uses more memory than 'maxmempattern'

Syntax highlighting stops at the comment right before the Question model.

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

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

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

// --------------------------------------

model User {
  id             Int      @id @default(autoincrement())
  createdAt      DateTime @default(now())
  updatedAt      DateTime @updatedAt
  name           String?
  email          String   @unique
  hashedPassword String?
  role           String   @default("USER")

  tokens   Token[]
  sessions Session[]
}

model Session {
  id                 Int       @id @default(autoincrement())
  createdAt          DateTime  @default(now())
  updatedAt          DateTime  @updatedAt
  expiresAt          DateTime?
  handle             String    @unique
  hashedSessionToken String?
  antiCSRFToken      String?
  publicData         String?
  privateData        String?

  user   User? @relation(fields: [userId], references: [id])
  userId Int?
}

model Token {
  id          Int      @id @default(autoincrement())
  createdAt   DateTime @default(now())
  updatedAt   DateTime @updatedAt
  hashedToken String
  type        String
  // See note below about TokenType enum
  // type        TokenType
  expiresAt   DateTime
  sentTo      String

  user   User @relation(fields: [userId], references: [id])
  userId Int

  @@unique([hashedToken, type])
}

// NOTE: It's highly recommended to use an enum for the token type
//       but enums only work in Postgres.
//       See: https://blitzjs.com/docs/database-overview#switch-to-postgre-sql
// enum TokenType {
//   RESET_PASSWORD
// }

model Question {
  id        Int      @id @default(autoincrement())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  text      String
  choices   Choice[]
}

model Choice {
  id         Int      @id @default(autoincrement())
  createdAt  DateTime @default(now())
  updatedAt  DateTime @updatedAt
  text       String
  votes      Int      @default(0)
  question   Question @relation(fields: [questionId], references: [id])
  questionId Int
}

isaacs avatar Apr 08 '22 22:04 isaacs

Possibly dupe of #4?

isaacs avatar Apr 08 '22 22:04 isaacs

Yeah, it is dupe of #4. I haven't found a good way yet to do block level highlights which avoiding this issue. You can try this workaround: https://github.com/pantharshit00/vim-prisma/issues/4#issuecomment-788197166

Personally I have migrated my setup to treesitter which is way better for doing syntax highlights imo: https://github.com/LumaKernel/tree-sitter-prisma

This tree sitter package now ships with neovim so if you are a neovim user, you should have this automatically.

pantharshit00 avatar May 30 '22 13:05 pantharshit00