@prisma/language-server 31.3.7 → 31.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__test__/completions/single-file.test.js +51 -2
- package/dist/__test__/completions/single-file.test.js.map +1 -1
- package/dist/lib/completions/completions.json +29 -0
- package/dist/lib/completions/generator.js +15 -0
- package/dist/lib/completions/generator.js.map +1 -1
- package/package.json +6 -6
- package/src/__test__/completions/single-file.test.ts +53 -2
- package/src/lib/completions/completions.json +29 -0
- package/src/lib/completions/generator.ts +24 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -431,6 +431,10 @@ describe('Completions', function () {
|
|
|
431
431
|
label: 'importFileExtension',
|
|
432
432
|
kind: CompletionItemKind.Field,
|
|
433
433
|
}
|
|
434
|
+
const fieldCompilerBuild = {
|
|
435
|
+
label: 'compilerBuild',
|
|
436
|
+
kind: CompletionItemKind.Field,
|
|
437
|
+
}
|
|
434
438
|
//#endregion
|
|
435
439
|
|
|
436
440
|
test('Diagnoses generator field suggestions in empty block', () => {
|
|
@@ -493,6 +497,7 @@ describe('Completions', function () {
|
|
|
493
497
|
fieldModuleFormat,
|
|
494
498
|
fieldGeneratedFileExtension,
|
|
495
499
|
fieldImportFileExtension,
|
|
500
|
+
fieldCompilerBuild,
|
|
496
501
|
],
|
|
497
502
|
},
|
|
498
503
|
})
|
|
@@ -713,6 +718,29 @@ describe('Completions', function () {
|
|
|
713
718
|
},
|
|
714
719
|
})
|
|
715
720
|
})
|
|
721
|
+
|
|
722
|
+
test('compilerBuild = "|"', () => {
|
|
723
|
+
assertCompletion({
|
|
724
|
+
schema: /* Prisma */ `
|
|
725
|
+
generator gen {
|
|
726
|
+
provider = "prisma-client"
|
|
727
|
+
compilerBuild = "|"
|
|
728
|
+
}`,
|
|
729
|
+
expected: {
|
|
730
|
+
isIncomplete: true,
|
|
731
|
+
items: [
|
|
732
|
+
{
|
|
733
|
+
label: 'fast',
|
|
734
|
+
kind: CompletionItemKind.Constant,
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
label: 'small',
|
|
738
|
+
kind: CompletionItemKind.Constant,
|
|
739
|
+
},
|
|
740
|
+
],
|
|
741
|
+
},
|
|
742
|
+
})
|
|
743
|
+
})
|
|
716
744
|
})
|
|
717
745
|
|
|
718
746
|
describe('prisma-client-js', () => {
|
|
@@ -725,7 +753,30 @@ describe('Completions', function () {
|
|
|
725
753
|
}`,
|
|
726
754
|
expected: {
|
|
727
755
|
isIncomplete: false,
|
|
728
|
-
items: [fieldPreviewFeatures, fieldOutput],
|
|
756
|
+
items: [fieldPreviewFeatures, fieldOutput, fieldCompilerBuild],
|
|
757
|
+
},
|
|
758
|
+
})
|
|
759
|
+
})
|
|
760
|
+
|
|
761
|
+
test('compilerBuild = "|"', () => {
|
|
762
|
+
assertCompletion({
|
|
763
|
+
schema: /* Prisma */ `
|
|
764
|
+
generator gen {
|
|
765
|
+
provider = "prisma-client-js"
|
|
766
|
+
compilerBuild = "|"
|
|
767
|
+
}`,
|
|
768
|
+
expected: {
|
|
769
|
+
isIncomplete: true,
|
|
770
|
+
items: [
|
|
771
|
+
{
|
|
772
|
+
label: 'fast',
|
|
773
|
+
kind: CompletionItemKind.Constant,
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
label: 'small',
|
|
777
|
+
kind: CompletionItemKind.Constant,
|
|
778
|
+
},
|
|
779
|
+
],
|
|
729
780
|
},
|
|
730
781
|
})
|
|
731
782
|
})
|
|
@@ -3112,7 +3163,7 @@ describe('Completions', function () {
|
|
|
3112
3163
|
id Int @id
|
|
3113
3164
|
lists ${scalarType}[] @default([|])
|
|
3114
3165
|
}
|
|
3115
|
-
|
|
3166
|
+
|
|
3116
3167
|
enum color {
|
|
3117
3168
|
RED
|
|
3118
3169
|
GREEN
|
|
@@ -119,6 +119,12 @@
|
|
|
119
119
|
"insertText": "importFileExtension = \"$0\"",
|
|
120
120
|
"documentation": "File extension used in import statements. Can be ts, mts, cts, js, mjs, cjs, or empty (for bare imports).",
|
|
121
121
|
"fullSignature": "importFileExtension = \"ts\" | \"mts\" | \"cts\" | \"js\" | \"mjs\" | \"cjs\" | \"\""
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"label": "compilerBuild",
|
|
125
|
+
"insertText": "compilerBuild = \"$0\"",
|
|
126
|
+
"documentation": "The build of the query compiler to use. Can be 'fast' or 'small'.",
|
|
127
|
+
"fullSignature": "compilerBuild = \"fast\" | \"small\""
|
|
122
128
|
}
|
|
123
129
|
],
|
|
124
130
|
"generatorPrismaClientJSFields": [
|
|
@@ -133,6 +139,12 @@
|
|
|
133
139
|
"insertText": "output = \"$0\"",
|
|
134
140
|
"documentation": "Determines the location for the generated client. Default: `node_modules/.prisma/client`. [Learn more](https://pris.ly/d/generator-fields).",
|
|
135
141
|
"fullSignature": "output = \"String\""
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"label": "compilerBuild",
|
|
145
|
+
"insertText": "compilerBuild = \"$0\"",
|
|
146
|
+
"documentation": "The build of the query compiler to use. Can be 'fast' or 'small'.",
|
|
147
|
+
"fullSignature": "compilerBuild = \"fast\" | \"small\""
|
|
136
148
|
}
|
|
137
149
|
],
|
|
138
150
|
"blockAttributes": [
|
|
@@ -519,6 +531,16 @@
|
|
|
519
531
|
"documentation": "For bare imports."
|
|
520
532
|
}
|
|
521
533
|
],
|
|
534
|
+
"compilerBuild": [
|
|
535
|
+
{
|
|
536
|
+
"label": "fast",
|
|
537
|
+
"documentation": "Faster query execution. Larger bundle size."
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
"label": "small",
|
|
541
|
+
"documentation": "Smaller bundle size. Slower query execution."
|
|
542
|
+
}
|
|
543
|
+
],
|
|
522
544
|
"runtimeArguments": [
|
|
523
545
|
{
|
|
524
546
|
"label": "\"\"",
|
|
@@ -547,6 +569,13 @@
|
|
|
547
569
|
"documentation": "File extension used in import statements."
|
|
548
570
|
}
|
|
549
571
|
],
|
|
572
|
+
"compilerBuildArguments": [
|
|
573
|
+
{
|
|
574
|
+
"label": "\"\"",
|
|
575
|
+
"insertText": "\"$0\"",
|
|
576
|
+
"documentation": "The build of the query compiler to use."
|
|
577
|
+
}
|
|
578
|
+
],
|
|
550
579
|
"datasourceProviders": [
|
|
551
580
|
{
|
|
552
581
|
"label": "mysql",
|
|
@@ -150,6 +150,16 @@ const importFileExtensions: CompletionItem[] = convertToCompletionItems(
|
|
|
150
150
|
CompletionItemKind.Constant,
|
|
151
151
|
)
|
|
152
152
|
|
|
153
|
+
const compilerBuildArguments: CompletionItem[] = convertToCompletionItems(
|
|
154
|
+
completions.compilerBuildArguments,
|
|
155
|
+
CompletionItemKind.Property,
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
const compilerBuilds: CompletionItem[] = convertToCompletionItems(
|
|
159
|
+
completions.compilerBuild,
|
|
160
|
+
CompletionItemKind.Constant,
|
|
161
|
+
)
|
|
162
|
+
|
|
153
163
|
// Fields for prisma-client generator
|
|
154
164
|
const prismaClientFields: CompletionItem[] = convertToCompletionItems(
|
|
155
165
|
completions.generatorPrismaClientFields,
|
|
@@ -383,4 +393,18 @@ export const generatorSuggestions = (
|
|
|
383
393
|
isIncomplete: true,
|
|
384
394
|
}
|
|
385
395
|
}
|
|
396
|
+
|
|
397
|
+
// compilerBuild
|
|
398
|
+
if (line.startsWith('compilerBuild')) {
|
|
399
|
+
if (isInsideQuotation) {
|
|
400
|
+
return {
|
|
401
|
+
items: compilerBuilds,
|
|
402
|
+
isIncomplete: true,
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return {
|
|
406
|
+
items: compilerBuildArguments,
|
|
407
|
+
isIncomplete: true,
|
|
408
|
+
}
|
|
409
|
+
}
|
|
386
410
|
}
|