Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Prisma language support #4668

Merged
merged 4 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,9 @@
[submodule "vendor/grammars/vscode-opa"]
path = vendor/grammars/vscode-opa
url = https://github.com/tsandall/vscode-opa
[submodule "vendor/grammars/vscode-prisma"]
path = vendor/grammars/vscode-prisma
url = https://github.com/prisma/vscode-prisma
[submodule "vendor/grammars/vscode-scala-syntax"]
path = vendor/grammars/vscode-scala-syntax
url = https://github.com/scala/vscode-scala-syntax
Expand Down
2 changes: 2 additions & 0 deletions grammars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,8 @@ vendor/grammars/vscode-lean:
- source.lean
vendor/grammars/vscode-opa:
- source.rego
vendor/grammars/vscode-prisma:
- source.prisma
vendor/grammars/vscode-scala-syntax:
- source.scala
vendor/grammars/vscode-slice:
Expand Down
7 changes: 7 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3968,6 +3968,13 @@ PowerShell:
interpreters:
- pwsh
language_id: 293
Prisma:
type: data
extensions:
- ".prisma"
tm_scope: source.prisma
ace_mode: text
language_id: 499933428
Processing:
type: programming
color: "#0096D8"
Expand Down
25 changes: 25 additions & 0 deletions samples/Prisma/blog-minimal-schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
datasource mysql {
provider = "mysql"
url = env("MYSQL_URL")
}

generator photon {
provider = "photonjs"
}

model Author {
id String @default(cuid()) @id @unique
email String @unique
name String?
posts Post[]
}

model Post {
id String @default(cuid()) @id @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
published Boolean
title String
content String?
author Author?
}
41 changes: 41 additions & 0 deletions samples/Prisma/blog-schema-advanced.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
datasource sqlite {
url = "file:data.db"
provider = "sqlite"
}

model User {
id Int @id
createdAt DateTime @default(now())
email String @unique
name String?
role Role @default(USER)
posts Post[]
profile Profile?
}

model Profile {
id Int @id
user User
bio String
}

model Post {
id Int @id
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
author User
title String
published Boolean @default(false)
categories Category[]
}

model Category {
id Int @id
name String
posts Post[]
}

enum Role {
USER
ADMIN
}
32 changes: 32 additions & 0 deletions samples/Prisma/mcu-schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
datasource db {
provider = "sqlite"
url = "file:dev.db"
default = true
}

generator photon {
provider = "photonjs"
output = "node_modules/@generated/photon"
}

generator nexus_prisma {
provider = "nexus-prisma"
output = "node_modules/@generated/nexus-prisma"
}

model Hero {
id String @default(cuid()) @id @unique
email String @unique
name String?
movies Movie[]
}

model Movie {
id String @default(cuid()) @id @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
released Boolean
title String
description String?
mainCharacter Hero?
}
121 changes: 121 additions & 0 deletions samples/Prisma/now-example-schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
datasource db {
provider = "mysql"
url = "mysql://prisma:localhost:3306/strapi"
}

generator photon {
provider = "photonjs"
}

model CoreStore {
id Int @id
environment String?
key String?
tag String?
type String?
value String?

@@map("core_store")
}

model Migration {
revision Int @id
applied Int
databaseMigration String @map("database_migration")
datamodel String
datamodelSteps String @map("datamodel_steps")
errors String
finishedAt DateTime? @map("finished_at")
name String
rolledBack Int @map("rolled_back")
startedAt DateTime @map("started_at")
status String

@@map("_Migration")
}

model Post {
id Int @id
content String?
createdAt DateTime? @map("created_at")
reads Int
title String
updatedAt DateTime? @map("updated_at")

@@map("posts")
}

model StrapiAdministrator {
id Int @id
blocked Boolean?
email String
password String
resetPasswordToken String?
username String

@@map("strapi_administrator")
}

model UploadFile {
id Int @id
createdAt DateTime? @map("created_at")
ext String?
hash String
mime String
name String
provider String
publicId String? @map("public_id")
sha256 String?
size String
updatedAt DateTime? @map("updated_at")
url String

@@map("upload_file")
}

model UploadFileMorph {
id Int @id
field String?
relatedId Int? @map("related_id")
relatedType String? @map("related_type")
uploadFileId Int? @map("upload_file_id")

@@map("upload_file_morph")
}

model UsersPermissionsPermission {
id Int @id
action String
controller String
enabled Boolean
policy String?
role Int?
type String

@@map("users-permissions_permission")
}

model UsersPermissionsRole {
id Int @id
description String?
name String
type String?

@@map("users-permissions_role")
}

model UsersPermissionsUser {
id Int @id
blocked Boolean?
confirmed Boolean?
createdAt DateTime? @map("created_at")
email String
password String?
provider String?
resetPasswordToken String?
role Int?
updatedAt DateTime? @map("updated_at")
username String

@@map("users-permissions_user")
}
33 changes: 33 additions & 0 deletions samples/Prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
datasource db {
provider = "sqlite"
url = "file:dev.db"
default = true
}

generator photon {
provider = "photonjs"
}

generator nexus_prisma {
provider = "nexus-prisma"
output = "node_modules/@generated/nexus-prisma"
}

model Post {
id String @default(cuid()) @id @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
published Boolean
title String
content String?
author User?
}


model User {
id String @default(cuid()) @id @unique
email String @unique
password String
name String?
posts Post[]
}
1 change: 1 addition & 0 deletions vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
- **PostCSS:** [hudochenkov/Syntax-highlighting-for-PostCSS](https://github.com/hudochenkov/Syntax-highlighting-for-PostCSS)
- **PostScript:** [textmate/postscript.tmbundle](https://github.com/textmate/postscript.tmbundle)
- **PowerShell:** [PowerShell/EditorSyntax](https://github.com/PowerShell/EditorSyntax)
- **Prisma:** [prisma/vscode-prisma](https://github.com/prisma/vscode-prisma)
- **Processing:** [textmate/processing.tmbundle](https://github.com/textmate/processing.tmbundle)
- **Prolog:** [alnkpa/sublimeprolog](https://github.com/alnkpa/sublimeprolog)
- **Propeller Spin:** [bitbased/sublime-spintools](https://github.com/bitbased/sublime-spintools)
Expand Down
1 change: 1 addition & 0 deletions vendor/grammars/vscode-prisma
Submodule vscode-prisma added at 3b602d
Loading