Skip to content

server: resolve config from workspace folders, rootUri, and rootPath - #1034

Open
reteps wants to merge 4 commits into
sbdchd:masterfrom
reteps:lsp-config-resolution
Open

server: resolve config from workspace folders, rootUri, and rootPath#1034
reteps wants to merge 4 commits into
sbdchd:masterfrom
reteps:lsp-config-resolution

Conversation

@reteps

@retepsreteps commented Apr 1, 2026

Copy link
Copy Markdown

Summary

  • Moves ConfigFile parsing from squawk CLI into squawk_linter so the LSP server can reuse it
  • Adds LintConfig in squawk_server to bridge config file settings into linter settings
  • Falls back to rootUri then rootPath when workspace_folders is absent, so clients that only set rootUri (common outside multi-root workspaces) correctly load .squawk.toml

Closes#679

Test plan

  • ./s/lint passes
  • ./s/test passes
  • Config snapshot tests pass after move to squawk_linter

🤖 Generated with Claude Code

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>
@netlify

netlifyBot commented Apr 1, 2026

Copy link
Copy Markdown

👷 Deploy request for squawkhq pending review.

Visit the deploys page to approve it

NameLink
🔨 Latest commit3faef9c

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>
@reteps
reteps marked this pull request as ready for review April 1, 2026 19:07
pub(crate) struct Snapshot {
pub(crate) db: Database,
pub(crate) files: Arc<FxHashMap<Url, File>>,
pub(crate) config: Arc<LintConfig>,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I like this feature, the server has been without config for far too long 😄

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

Comment threadcrates/squawk_server/src/server.rs Outdated
Comment threadcrates/squawk_server/src/ignore.rs Outdated
Comment threadcrates/squawk_server/src/server.rs Outdated
@reteps
reteps marked this pull request as draft May 1, 2026 15:02
Peter Stenger added 2 commits May 1, 2026 10:15
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
@reteps
reteps marked this pull request as ready for review May 1, 2026 15:29
@reteps
reteps requested a review from sbdchdMay 1, 2026 15:29
Sign up for freeto 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.

VSCode Extension shows errors ignored by the config file.

2 participants

@reteps@sbdchd