File tree 1 file changed +12
-8
lines changed
packages/language-server/src/lib/ast
1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -32,15 +32,19 @@ export function getFirstDatasourceProvider(schema: PrismaSchema): string | undef
32
32
}
33
33
34
34
export function getAllPreviewFeaturesFromGenerators ( schema : PrismaSchema ) : PreviewFeatures [ ] | undefined {
35
- // matches any `previewFeatures = [x]` in any position
36
- // thanks to https://regex101.com for the online scratchpad
37
- const previewFeaturesRegex = / p r e v i e w F e a t u r e s \s = \s ( \[ .* \] ) / g
35
+ /**
36
+ * ```prisma
37
+ * generator client {
38
+ * provider = "prisma-client-js"
39
+ * // previewFeatures = [] // This will be ignored
40
+ * previewFeatures = ["views"]
41
+ * }
42
+ * ```
43
+ *
44
+ * ? for more info: https://regex101.com/r/ezoTU2/1
45
+ */
46
+ const previewFeaturesRegex = / ^ \s * (? ! \/ \/ \s ) p r e v i e w F e a t u r e s \s = \s ( \[ .* \] ) / m
38
47
39
- // we could match against all the `previewFeatures = [x]` (could be that there is more than one?)
40
- // var matchAll = text.matchAll(regexp)
41
- // for (const match of matchAll) {
42
- // console.log(match);
43
- // }
44
48
const result = schema . findWithRegex ( previewFeaturesRegex )
45
49
46
50
if ( ! result || ! result . match [ 1 ] ) {
You can’t perform that action at this time.
0 commit comments