Skip to content

prismaSchemaFolder glob pattern uses wrong path separator on Windows, breaking multi-file schema discovery #1985

Description

@chirag127

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

  1. Enable prismaSchemaFolder in a Prisma 5+ project on Windows.
  2. Create the schema folder structure:
    prisma/
      schema/
        base.prisma
        user.prisma
        product.prisma
    
  3. Add prismaSchemaFolder to generator client block.
  4. Open VS Code on Windows. Observe that sometimes only some of the .prisma files get syntax highlighting and autocompletion; others show no language features.
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions