Repository navigation
Conversation
pull_file_formatting builds the format config and formats the document in server/formatting.rs, together with collapse_blank_lines and restore_named_parameters. The code is moved as it was.
…ter visitors LintVisitor and SplinterVisitor only differed in the rules that the configuration enables and disables, and in the check of linter.enabled and typecheck.enabled for the lint rules. Both are now a RuleSelection, and AnalyserVisitorBuilder passes the configured rules and applies the check. The splinter category is of the lint kind, so filtering the categories to lint as LintVisitor did visits the same rules.
Closed
This was referenced Oct 26, 2026
Collaborator
Author
|
Superseded by #988 (rebuild of the document caches and walk). |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stacked on #974.
Two moves in the workspace server that change no behaviour.
Formatting moves to
server/formatting.rspull_file_formattinghad about 200 lines of formatting inline: it built theFormatConfig, formatted the bodies of SQL functions, and rebuilt the file from the formatted statements and the text between them.collapse_blank_linesandrestore_named_parameterssat at the end ofserver.rs. These now live inserver/formatting.rsasformat_configandformat_document(doc, settings, range, path), together with the two helpers.pull_file_formattingreads the settings and the document, callsformat_document, and charges the document caches. The code moved as it was. It readssettings.formatter.xassettings.xandparams.rangeasrange, and nothing else changed.server.rsgoes from 2,141 to 1,876 lines.One visitor for the lint and splinter rule selection
LintVisitorandSplinterVisitorinserver/analyser.rswere copies of each other with two differences:only(as_linter_rulesoras_splinter_rules);linter.enabledis off, and the typecheck rules whentypecheck.enabledis off.They are now one
RuleSelectionthat collects whatonlyandskipselect.AnalyserVisitorBuilder::finishpasses in the configured rules and applies theenabledcheck to the lint rules. The splinter visitor recorded every category, while the lint visitor only recorded the categories of the lint kind. The splinter registry has one category, anddeclare_category!declares it withkind: Lint, so the shared filter visits the same rules.Tests
The existing tests cover both: the formatting tests in
pgls_workspace(ranges, SQL function bodies, named parameters, blank lines) andrecognizes_disabled_linter_rulesplus the diagnostics tests withonly/skip.cargo test -p pgls_workspaceand clippy pass.