server: resolve config from workspace folders, rootUri, and rootPath#1034
server: resolve config from workspace folders, rootUri, and rootPath#1034reteps wants to merge 4 commits intosbdchd:masterfrom
Conversation
Move ConfigFile parsing from squawk into squawk_linter so the LSP server can reuse it. Add LintConfig in squawk_server to bridge ConfigFile settings into linter settings. The server now falls back to rootUri and rootPath when workspace_folders is absent, so clients that only set rootUri (common outside multi-root workspaces) will correctly load .squawk.toml. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
👷 Deploy request for squawkhq pending review.Visit the deploys page to approve it
|
Glob patterns in .squawk.toml (e.g. migrations/*.sql) are relative, but the LSP was comparing them against the absolute URI path, so they never matched. Now also strips the workspace root to produce a relative path for matching. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| pub(crate) struct Snapshot { | ||
| pub(crate) db: Database, | ||
| pub(crate) files: Arc<FxHashMap<Url, File>>, | ||
| pub(crate) config: Arc<LintConfig>, |
There was a problem hiding this comment.
I'm not 100% sure, but I think it might be better if we put the config in the Salsa database instead
And then we can more easily access without having to pass it around
Another thing I was thinking about is setting up the language server to watch for the config file changes, but that might be a lot of work
There was a problem hiding this comment.
I like this feature, the server has been without config for far too long 😄
There was a problem hiding this comment.
Decided to keep Arc<LintConfig> for now. Since the config is set once at server startup and doesn't change during the session, putting it in Salsa as a #[salsa::input] would still leave us holding the input handle on Snapshot/GlobalState, so we'd be passing it around either way. The reactive-invalidation benefit of Salsa would really pay off once we wire up file-watching for .squawk.toml changes — happy to revisit then.
Address PR review comments: - Avoid duplicating workspace_root by adding LintConfig::from_init_params which reads it once and resolves the config file internally - Scope #[allow(deprecated)] to a single block in the helper for the root_uri/root_path fallbacks - Replace LintConfig::from_config_file(None, None) test calls with a derived Default impl
Summary
ConfigFileparsing fromsquawkCLI intosquawk_linterso the LSP server can reuse itLintConfiginsquawk_serverto bridge config file settings into linter settingsrootUrithenrootPathwhenworkspace_foldersis absent, so clients that only setrootUri(common outside multi-root workspaces) correctly load.squawk.tomlCloses #679
Test plan
./s/lintpasses./s/testpassessquawk_linter🤖 Generated with Claude Code