Repository navigation
feat(catalog): keep editor features working after DO, CALL and unparsable statements; resolve CALL - #914
Open
psteinroe wants to merge 1 commit into
Conversation
…able statements; resolve CALL Editor features walk the file with a best-effort catalog, which ignores statements whose effects it can't follow instead of treating every lookup after them as unknown. The linter keeps the strict catalog. CALL records a reference to the procedure it calls, so it gets inlay hints, a semantic token and hover. Its arguments' findings are dropped, since Postgres' checks of CALL are not ported.
This was referenced Oct 24, 2026
This branch has not been deployed
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 #911.
One
DOblock,CALL,EXECUTE, or half-typed DDL statement turned off function hints, function tokens, enum tokens and resolved overloads for the rest of the file, andCALLitself got nothing.Best-effort catalog for editor features
Catalog::applytaints the catalog on statements it can't model, andwalk_statementstaints it on statements that don't parse. From then on nothing is missing, function and operator candidates are incomplete, and casts are unknown, so noFunctionorEnumLiteralreference is recorded. That is right for the linter, which only reports what is certain, but too strict for hints, tokens and hover, and it made hints below the cursor flicker while typing.Catalog::best_effort()returns a catalog whose lookups ignore the taint: it keeps answering from the database and the statements it could follow, and still only finds objects that exist there. Onlywalk_statements(hover, inlay hints, semantic tokens) uses it. The linter's catalog is unchanged, the Postgres regression suite and the analyser specs pass, andreferences_are_only_collected_on_requeststill checks that findings don't depend on collecting references. The trade-off: an object aDOblock creates is unknown and one it drops is still found, which the docs now say.CALLThe resolver now handles
CallStmt, only when references are collected: the arguments are typed (so nested calls, casts and enum literals get references), and the call goes throughselect_function. A reference is recorded when the match is a procedure without output parameters, becauseCALLpasses an argument forOUTparameters too, so they wouldn't line up with the signature. The findings of the arguments are dropped: Postgres' checks ofCALL(transformCallStmt) aren't ported, and the linter output must not change.Hover: the editor grammar doesn't classify the name in
CALL, so hover found no node and returned nothing. When there is no hovered node, hover now shows the function of aFunctionreference at the cursor.Tests
pgls_catalog:procedure_call_references(named arguments, nested calls, procedures withOUTparameters and non-procedures skipped),best_effort_catalogs_ignore_unmodelled_statements(the same statement afterDOwith a strict and a best-effort catalog), andCALLinreferences_are_only_collected_on_request.pgls_workspace: hints, tokens and hover after a brokencreate table, aDOblock and aCALL.pgls_hover: snapshot for hovering a procedure inCALL(only the matching overload).Not covered
call public.proc()shows the procedure too, since the fallback has no hovered node to tell the parts apart.CALLof procedures withOUTorINOUTparameters.Follow-ups:
CALLof procedures withOUT/INOUTparameters is added in #937.