Skip to content

Conversation

juleswritescode
Copy link
Collaborator

@juleswritescode juleswritescode commented Aug 30, 2025

Adds a linter.searchPathPatterns option where a user can add glob-patterns for additional schemas to be searched when typechecking.

Screenshot 2025-08-30 at 07 54 00 Screenshot 2025-08-30 at 07 54 13 Screenshot 2025-08-30 at 07 54 30

Copy link
Collaborator

@psteinroe psteinroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

a few nits:

  • is linter the right place for this? Or rather db settings?
  • maybe we can compile the glob already in the settings, and not in every typecheck run?

@juleswritescode
Copy link
Collaborator Author

juleswritescode commented Aug 30, 2025

is linter the right place for this? Or rather db settings?

Hmm had it there at first :D The reason I used the linter in the end was that the search_path only applies to the type checking, and to nothing else DB related. for example, if we use the EXECUTE STATEMENT feature, it'll not use those search paths.

I also fear that there might be a misunderstanding that you "configure the db to use the search_path".

But I don't have a strong opinion on this. What do you prefer?

@psteinroe
Copy link
Collaborator

is linter the right place for this? Or rather db settings?

Hmm had it there at first :D The reason I used the linter in the end was that the search_path only applies to the type checking, and to nothing else DB related. for example, if we use the EXECUTE STATEMENT feature, it'll not use those search paths.

I also fear that there might be a misunderstanding that you "configure the db to use the search_path".

But I don't have a strong opinion on this. What do you prefer?

mhh what do you think of adding a new section into he settings for typechecking? That way, we can also add disable etc. linting and type checking are two different things after all. and the lint settings are used to configure individual rules.

@juleswritescode
Copy link
Collaborator Author

juleswritescode commented Aug 31, 2025

is linter the right place for this? Or rather db settings?

Hmm had it there at first :D The reason I used the linter in the end was that the search_path only applies to the type checking, and to nothing else DB related. for example, if we use the EXECUTE STATEMENT feature, it'll not use those search paths.
I also fear that there might be a misunderstanding that you "configure the db to use the search_path".
But I don't have a strong opinion on this. What do you prefer?

mhh what do you think of adding a new section into he settings for typechecking? That way, we can also add disable etc. linting and type checking are two different things after all. and the lint settings are used to configure individual rules.

I think that's a good idea! I'll do it in this PR

@juleswritescode
Copy link
Collaborator Author

done!

Copy link
Collaborator

@psteinroe psteinroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@@ -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();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: why not passing the entire config struct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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

@juleswritescode juleswritescode merged commit 8869683 into main Aug 31, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants