Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
schemaPathSetting Support to Language ServerSummary
This PR adds support for the
prisma.schemaPathVS Code setting to the Language Server, enabling proper multi-file schema support in monorepos and projects with custom schema locations.Problem
Previously, the
prisma.schemaPathsetting was only used for CLI commands (likeprisma generate) but was not passed to the Language Server. This caused the following issues:prisma.config.tswas not at the workspace root (colocated at the custom directory)The Prisma CLI (generate, validate, etc.) worked with the same configuration, making this purely a Language Server/extension issue.
Solution
This PR implements the following changes:
1. Language Server Changes (
packages/language-server/)src/lib/types.ts: AddedschemaPathfield toLSSettingsinterfacesrc/lib/Schema.ts:PrismaSchemaLoadOptionsinterface withschemaPathandconfigRootoptionsPrismaSchema.load()to accept options object (backward compatible with stringconfigRoot)schemaPathfrom VS Code settingsschemapath fromprisma.config.tssrc/server.ts: Updated all LSP request handlers to passschemaPathfrom settings toPrismaSchema.load()2. VS Code Extension Changes (
packages/vscode/)package.json: Updatedprisma.schemaPathsetting description to clarify it now works with the Language Server and supports directories3. Tests (
packages/language-server/src/__test__/)schema-path.test.ts: Test suite covering:schemaPathoptionschemaPathis not providedconfigRootparameterschemaPathoverprisma.config.tsSchemaDocumentarrays4. Documentation
docs/language-server.md: Added detailed section on schema path resolution and VS Code configurationpackages/vscode/package.json: Enhanced setting description with examplesBehavior
Before
After
Schema Path Resolution Priority
schemaPathoption (from VS Codeprisma.schemaPathsetting)prisma.config.ts(discovered by searching upward fromschemaPathor current document)This matches the Prisma CLI behavior, ensuring consistency between IDE and command-line tooling.
Configuration Example
Users can now configure multi-file schemas in monorepos:
Backward Compatibility
PrismaSchema.load(input, configRoot)continues to workconfigRootparameter are unaffectedschemaPathsetting work as before