-
Notifications
You must be signed in to change notification settings - Fork 103
feat: provide additional search_path patterns for typechecking #484
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4e43e01
intermeidary
juleswritescode ead4101
so far
juleswritescode 8151d99
readied
juleswritescode c0e8430
Update crates/pgt_schema_cache/Cargo.toml
juleswritescode 4b6484a
Update crates/pgt_schema_cache/src/schema_cache.rs
juleswritescode 693f47c
adjusties
juleswritescode 343e1fc
ok
juleswritescode da29662
format
juleswritescode 2d42574
add a test like a grown up
juleswritescode 521cb15
Merge branch 'issue/#482' of https://github.com/supabase-community/po...
juleswritescode ccde6e7
Update postgrestools.jsonc
juleswritescode 3464003
move to typecheck
juleswritescode 7064fed
progress
juleswritescode c47436d
just readied
juleswritescode 4c8be33
remove unnecessary
juleswritescode File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
Cargo.lock
Oops, something went wrong.
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
25 changes: 25 additions & 0 deletions
crates/pgt_configuration/src/typecheck.rs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use biome_deserialize::StringSet; | ||
use biome_deserialize_macros::{Merge, Partial}; | ||
use bpaf::Bpaf; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// The configuration for type checking. | ||
#[derive(Clone, Debug, Deserialize, Eq, Partial, PartialEq, Serialize)] | ||
#[partial(derive(Bpaf, Clone, Eq, PartialEq, Merge))] | ||
#[partial(cfg_attr(feature = "schema", derive(schemars::JsonSchema)))] | ||
#[partial(serde(rename_all = "camelCase", default, deny_unknown_fields))] | ||
pub struct TypecheckConfiguration { | ||
/// Default search path schemas for type checking. | ||
/// Can be a list of schema names or glob patterns like ["public", "app_*"]. | ||
/// If not specified, defaults to ["public"]. | ||
#[partial(bpaf(long("search_path")))] | ||
pub search_path: StringSet, | ||
} | ||
|
||
impl Default for TypecheckConfiguration { | ||
fn default() -> Self { | ||
Self { | ||
search_path: ["public".to_string()].into_iter().collect(), | ||
} | ||
} | ||
} |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -455,6 +455,7 @@ impl Workspace for WorkspaceServer { | |
let path_clone = params.path.clone(); | ||
let schema_cache = self.schema_cache.load(pool.clone())?; | ||
let input = doc.iter(TypecheckDiagnosticsMapper).collect::<Vec<_>>(); | ||
let search_path_patterns = settings.typecheck.search_path.clone(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: why not passing the entire config struct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because of a circular dependency: workspace depends on typecheck, typecheck depends on workspace::TypecheckSettings |
||
|
||
// Combined async context for both typecheck and plpgsql_check | ||
let async_results = run_async(async move { | ||
|
@@ -463,6 +464,8 @@ impl Workspace for WorkspaceServer { | |
let pool = pool.clone(); | ||
let path = path_clone.clone(); | ||
let schema_cache = Arc::clone(&schema_cache); | ||
let search_path_patterns = search_path_patterns.clone(); | ||
|
||
async move { | ||
let mut diagnostics = Vec::new(); | ||
|
||
|
@@ -474,6 +477,7 @@ impl Workspace for WorkspaceServer { | |
ast: &ast, | ||
tree: &cst, | ||
schema_cache: schema_cache.as_ref(), | ||
search_path_patterns, | ||
identifiers: sign | ||
.map(|s| { | ||
s.args | ||
|
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
Oops, something went wrong.
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.