-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prisma-fmt: Make get_config
error tolerant
#4875
Conversation
CodSpeed Performance ReportMerging #4875 will not alter performanceComparing Summary
|
WASM Query Engine file Size
|
7f06c79
to
f99e7a8
Compare
🚀 WASM query-engine performance will improve by 2.44%Full benchmark report
After changes in 49eaa97 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me!
52596dc
to
6ddcfcd
Compare
parse_confgiration_multi
error tolerantget_config
error tolerant
psl/psl/src/lib.rs
Outdated
/// blocks. It never fails, but when the returned `Diagnostics` contains errors, it implies that the | ||
/// `Configuration` content is partial. | ||
/// Consumers may then decide whether to convert `Diagnostics` into an error. | ||
pub fn infallible_parse_configuration(files: &[(String, SourceFile)]) -> (Files, Configuration, Diagnostics) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I keep getting confused by this being called infallible and thinking ah, yes, no issues at all, wait, why are we getting diagnostics, what happened to our infallible leader!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SevInf, maybe parse_config_best_effort
could better emphasise the role of this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good 👍
Now the function never fails and always returns both `Config` and `Diagnostics`. In case of errors, `Diagnostic` would be non-empty, but it will still try to return as much of a config as it was able to parse. This is useful mostly for dev tools - they need to be able to read preview feature from more invalid files than old `get_config` would've allowed. It also improves diagnostics in the CLI since we are now also able to tell that user wanted to have more cases. This is a breaking change to consumers of `prisma-fmt`: both prisma cli and language-tools would need to be adapted to the new signature. Contributes to prisma/team-orm#1143 Contributes to prisma/team-orm#1127 (opportunistic refactor)
49eaa97
to
033c2c5
Compare
Integrates prisma/prisma-engines#4875. Adapts `get_config` to changes from internals. Closes prisma/team-orm#1143
Integrates prisma/prisma-engines#4875. Adapts `get_config` to changes from internals. Closes prisma/team-orm#1143
Integrates prisma/prisma-engines#4875. Adapts `get_config` to changes from internals. Closes prisma/team-orm#1143
…24349) * feat(schema-files-loader): Read preview feature from invalid schemas Integrates prisma/prisma-engines#4875. Adapts `get_config` to changes from internals. Closes prisma/team-orm#1143 * Bump engine
Adds new function
infallible_parse_configuration
that never fails and always returns bothConfig
andDiagnostics
. In case of errors,Diagnostic
would be non-empty, butit will still try to return as much of a config as it was able to parse.
This is useful mostly for dev tools - they need to be able to read
preview feature from more invalid files than old
get_config
would'veallowed. It also improves diagnostics in the CLI since we are now also
able to tell that user wanted to have more cases.
This is a breaking change to consumers of
prisma-fmt
: both prisma cliand language-tools would need to be adapted to the new signature.
Contributes to prisma/team-orm#1143
Contributes to prisma/team-orm#1127 (opportunistic refactor)