-
Notifications
You must be signed in to change notification settings - Fork 102
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
Changes from all commits
4e43e01
ead4101
8151d99
c0e8430
4b6484a
693f47c
343e1fc
da29662
2d42574
521cb15
ccde6e7
3464003
7064fed
c47436d
4c8be33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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(), | ||
} | ||
} | ||
} |
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 | ||
|
Uh oh!
There was an error while loading. Please reload this page.