Problem
When using the prismaSchemaFolder preview feature with a multi-file schema setup, the language server fails to discover schema files on Windows. The language server constructs glob patterns using forward slashes internally, but vscode.workspace.findFiles and the underlying VS Code glob engine on Windows sometimes produces fsPath values with backslashes. When the extension compares these paths for deduplication or watching, the mismatch causes some schema files to appear as unknown or to not be watched for changes.
Steps to Reproduce
- Enable
prismaSchemaFolder in a Prisma 5+ project on Windows.
- Create the schema folder structure:
prisma/
schema/
base.prisma
user.prisma
product.prisma
- Add
prismaSchemaFolder to generator client block.
- Open VS Code on Windows. Observe that sometimes only some of the
.prisma files get syntax highlighting and autocompletion; others show no language features.
- Editing
user.prisma does not trigger validation of product.prisma (cross-file reference broken).
Root Cause
Path comparison in the language server file watcher and document store uses string equality. On Windows, uri.fsPath returns C:\Users\...\prisma\schema\user.prisma while the glob result may be C:/Users/.../prisma/schema/user.prisma. These compare as unequal.
Proposed Fix
Normalise all paths to uri.toString() (scheme+authority+path, always forward-slash) before storing and comparing. Alternatively, use vscode.Uri.file(path).toString() to canonicalise before equality checks.
Environment
- OS: Windows 11 Enterprise 10.0.26200
- Prisma: 5.x with
prismaSchemaFolder preview enabled
- VS Code: 1.89+
- Extension: prisma.prisma latest
Problem
When using the
prismaSchemaFolderpreview feature with a multi-file schema setup, the language server fails to discover schema files on Windows. The language server constructs glob patterns using forward slashes internally, butvscode.workspace.findFilesand the underlying VS Code glob engine on Windows sometimes producesfsPathvalues with backslashes. When the extension compares these paths for deduplication or watching, the mismatch causes some schema files to appear asunknownor to not be watched for changes.Steps to Reproduce
prismaSchemaFolderin a Prisma 5+ project on Windows.prismaSchemaFoldertogenerator clientblock..prismafiles get syntax highlighting and autocompletion; others show no language features.user.prismadoes not trigger validation ofproduct.prisma(cross-file reference broken).Root Cause
Path comparison in the language server file watcher and document store uses string equality. On Windows,
uri.fsPathreturnsC:\Users\...\prisma\schema\user.prismawhile the glob result may beC:/Users/.../prisma/schema/user.prisma. These compare as unequal.Proposed Fix
Normalise all paths to
uri.toString()(scheme+authority+path, always forward-slash) before storing and comparing. Alternatively, usevscode.Uri.file(path).toString()to canonicalise before equality checks.Environment
prismaSchemaFolderpreview enabled